Class: Antelope::Grammar::Token::Epsilon

Inherits:
Antelope::Grammar::Token show all
Defined in:
lib/antelope/grammar/token/epsilon.rb

Overview

Defines an epsilon token. An epsilon token represents nothing. This is used to say that a nonterminal can reduce to nothing.

Instance Attribute Summary

Attributes inherited from Antelope::Grammar::Token

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

Instance Method Summary collapse

Methods inherited from Antelope::Grammar::Token

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

Constructor Details

#initializeEpsilon

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



12
13
14
# File 'lib/antelope/grammar/token/epsilon.rb', line 12

def initialize(*)
  super :"$empty"
end

Instance Method Details

#epsilon?Boolean

This method is abstract.

Whether or not the token is an epsilon token.

Returns:

  • (Boolean)


17
18
19
# File 'lib/antelope/grammar/token/epsilon.rb', line 17

def epsilon?
  true
end