Class: Rley::Syntax::GrmSymbol
- Inherits:
-
Object
- Object
- Rley::Syntax::GrmSymbol
- Defined in:
- lib/rley/syntax/grm_symbol.rb
Overview
Abstract class for grammar symbols. A grammar symbol is an element that appears in grammar rules.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
The name of the grammar symbol.
Instance Method Summary collapse
-
#initialize(aName) ⇒ GrmSymbol
constructor
Constructor.
-
#terminal? ⇒ Boolean
Return true iff the symbol is a terminal.
-
#to_s ⇒ String
The String representation of the grammar symbol.
Constructor Details
#initialize(aName) ⇒ GrmSymbol
Constructor. aName [String] The name of the grammar symbol.
11 12 13 |
# File 'lib/rley/syntax/grm_symbol.rb', line 11 def initialize(aName) @name = aName.dup end |
Instance Attribute Details
#name ⇒ Object (readonly)
The name of the grammar symbol
7 8 9 |
# File 'lib/rley/syntax/grm_symbol.rb', line 7 def name @name end |
Instance Method Details
#terminal? ⇒ Boolean
Return true iff the symbol is a terminal
16 17 18 19 |
# File 'lib/rley/syntax/grm_symbol.rb', line 16 def terminal?() # Default implementation to override if necessary return false end |
#to_s ⇒ String
The String representation of the grammar symbol
23 24 25 |
# File 'lib/rley/syntax/grm_symbol.rb', line 23 def to_s() return name.to_s end |