Method: ANTLR3::Recognizer#token_error_display
- Defined in:
- lib/antlr3/recognizers.rb
#token_error_display(token) ⇒ Object
formats a token object appropriately for inspection within an error message
474 475 476 477 478 479 480 481 482 483 484 485 |
# File 'lib/antlr3/recognizers.rb', line 474 def token_error_display( token ) unless text = token.text || ( token.source_text rescue nil ) text = case when token.type == EOF then '<EOF>' when name = token_name( token.type ) rescue nil then "<#{ name }>" when token.respond_to?( :name ) then "<#{ token.name }>" else "<#{ token.type }>" end end return text.inspect end |