Class: Antelope::Grammar::Token::Error

Inherits:
Terminal show all
Defined in:
lib/antelope/grammar/token/error.rb

Overview

Defines an error token. This may be used internally by the parser when it enters panic mode; any tokens following this are the synchronisation tokens. This is considered a terminal for the purposes of rule definitions.

Instance Attribute Summary

Attributes inherited from Antelope::Grammar::Token

#from, #id, #name, #to, #type

Instance Method Summary collapse

Methods inherited from Terminal

#terminal?

Methods inherited from Antelope::Grammar::Token

#<=>, #===, #epsilon?, #hash, #inspect, #invalidate_cache!, #nonterminal?, #terminal?, #to_a, #to_s, #without_transitions

Constructor Details

#initializeError

Initialize the error token. Technically takes no arguments. Sets the name to be :$error.



13
14
15
# File 'lib/antelope/grammar/token/error.rb', line 13

def initialize(*)
  super :$error
end

Instance Method Details

#error?Boolean

This method is abstract.

Whether or not the token is an error token.

Returns:

  • (Boolean)


18
19
20
# File 'lib/antelope/grammar/token/error.rb', line 18

def error?
  true
end