class Rley::Syntax::GrmSymbol
Abstract class for grammar symbols. A grammar symbol is an element that appears in grammar rules.
Attributes
@return [String] The name of the grammar symbol
Public Class Methods
Source
# File lib/rley/syntax/grm_symbol.rb, line 13 def initialize(aName) raise 'Internal error: nil name encountered' if aName.nil? @name = aName.dup @name.freeze end
Constructor. aName [String] The name of the grammar symbol.
Public Instance Methods
Source
# File lib/rley/syntax/grm_symbol.rb, line 33 def generative? @generative end
@return [Boolean] true iff the symbol is generative.
Source
# File lib/rley/syntax/grm_symbol.rb, line 27 def terminal? # Default implementation to override if necessary false end
@return [Boolean] true iff the symbol is a terminal
Source
# File lib/rley/syntax/grm_symbol.rb, line 22 def to_s name.to_s end
The String representation of the grammar symbol @return [String]