Class: ParseDoCond

Inherits:
ParseCond show all
Defined in:
lib/saikuro.rb

Instance Attribute Summary

Attributes inherited from ParseState

#children, #complexity, #lines, #name, #parent

Instance Method Summary collapse

Methods inherited from EndableParseState

#do_end_token

Methods inherited from ParseState

#calc_complexity, #calc_lines, #compute_state, #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_constant_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, set_token_counter, #top_state?

Constructor Details

#initialize(lexer, parent = nil) ⇒ ParseDoCond

Returns a new instance of ParseDoCond.



534
535
536
537
# File 'lib/saikuro.rb', line 534

def initialize(lexer,parent=nil)
  super(lexer,parent)
  @looking_for_new_line = true
end

Instance Method Details

#parse_token(token) ⇒ Object

Need to consume the do that can appear at the end of these control structures.



541
542
543
544
545
546
547
548
549
550
551
552
553
554
# File 'lib/saikuro.rb', line 541

def parse_token(token)
  if @looking_for_new_line
    if token.is_a?(TkDO)
      nil
    else
      if token.is_a?(TkNL)
        @looking_for_new_line = false
      end
      super(token)
    end
  else
    super(token)
  end
end