def parse_token(token)
state = nil
case token
when TkCLASS
state = do_class_token(token)
when TkMODULE
state = do_module_token(token)
when TkDEF
state = do_def_token(token)
when TkCONSTANT
state = do_constant_token(token)
when TkIDENTIFIER,TkFID
state = do_identifier_token(token)
when TkRBRACE
state = do_right_brace_token(token)
when TkEND
state = do_end_token(token)
when TkDO,TkfLBRACE
state = do_block_token(token)
when TkIF,TkUNLESS
state = do_conditional_token(token)
when TkWHILE,TkUNTIL,TkFOR
state = do_conditional_do_control_token(token)
when TkELSIF
@complexity += 1
when TkELSE
when TkCASE
state = do_case_token(token)
when TkWHEN
@complexity += 1
when TkBEGIN
state = do_begin_token(token)
when TkRESCUE
@complexity += 1
when TkIF_MOD, TkUNLESS_MOD, TkUNTIL_MOD, TkWHILE_MOD, TkQUESTION
state = do_one_line_conditional_token(token)
when TkNL
@lines += 1
when TkRETURN
when TkCOMMENT
state = do_comment_token(token)
when TkSYMBEG
state = do_symbol_token(token)
when TkError
STDOUT.puts "Lexer received an error for line #{@lexer.line_no} char #{@lexer.char_no}"
else
state = do_else_token(token)
end
state.parse if state
end