Class: Rley::Syntax::Terminal
- Defined in:
- lib/rley/syntax/terminal.rb
Overview
A terminal symbol represents a class of words in the language defined the grammar.
Instance Attribute Summary
Attributes inherited from GrmSymbol
Instance Method Summary collapse
-
#generative? ⇒ TrueClass
An indicator that tells whether the grammar symbol can generate a non-empty string of terminals.
-
#nullable? ⇒ false, FalseClass
the empty string.
-
#terminal? ⇒ TrueClass
Return true iff the symbol is a terminal.
-
#to_s ⇒ String
Return a readable text representation of the instance.
Methods inherited from GrmSymbol
Constructor Details
This class inherits a constructor from Rley::Syntax::GrmSymbol
Instance Method Details
#generative? ⇒ TrueClass
An indicator that tells whether the grammar symbol can generate a non-empty string of terminals.
13 14 15 |
# File 'lib/rley/syntax/terminal.rb', line 13 def generative? true end |
#nullable? ⇒ false, FalseClass
the empty string. As terminal symbol corresponds to a input token it is by definition non-nullable.
27 28 29 |
# File 'lib/rley/syntax/terminal.rb', line 27 def nullable? false end |
#terminal? ⇒ TrueClass
Return true iff the symbol is a terminal
19 20 21 |
# File 'lib/rley/syntax/terminal.rb', line 19 def terminal? true end |
#to_s ⇒ String
Return a readable text representation of the instance
33 34 35 |
# File 'lib/rley/syntax/terminal.rb', line 33 def to_s name end |