Class: ParseClass
- Inherits:
-
EndableParseState
- Object
- ParseState
- EndableParseState
- ParseClass
- Defined in:
- lib/saikuro.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from ParseState
#children, #complexity, #lines, #name, #parent
Instance Method Summary collapse
- #compute_state(formater) ⇒ Object
- #do_constant_token(token) ⇒ Object
-
#initialize(lexer, parent = nil) ⇒ ParseClass
constructor
A new instance of ParseClass.
Methods inherited from EndableParseState
Methods inherited from ParseState
#calc_complexity, #calc_lines, #compute_state_for_global, #count_tokens?, #do_begin_token, #do_block_token, #do_case_token, #do_class_token, #do_comment_token, #do_conditional_do_control_token, #do_conditional_token, #do_def_token, #do_else_token, #do_end_token, #do_identifier_token, #do_module_token, #do_one_line_conditional_token, #do_right_brace_token, #do_symbol_token, #end_debug, get_token_counter, #lexer=, #lexer_loop?, #make_state, make_top_state, #parse, #parse_token, set_token_counter, #top_state?
Constructor Details
#initialize(lexer, parent = nil) ⇒ ParseClass
Returns a new instance of ParseClass.
430 431 432 433 |
# File 'lib/saikuro.rb', line 430 def initialize(lexer,parent=nil) super(lexer,parent) @type_name = "Class" end |
Instance Method Details
#compute_state(formater) ⇒ Object
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
# File 'lib/saikuro.rb', line 440 def compute_state(formater) # Seperate the Module and Class Children out cnm_children, @children = @children.partition do |child| child.kind_of?(ParseClass) end formater.start_class_compute_state(@type_name,@name,self.calc_complexity,self.calc_lines) super(formater) formater.end_class_compute_state(@name) cnm_children.each do |child| child.name = @name + "::" + child.name child.compute_state(formater) end end |
#do_constant_token(token) ⇒ Object
435 436 437 438 |
# File 'lib/saikuro.rb', line 435 def do_constant_token(token) @name = token.name if @name.empty? nil end |