Module: Antelope::Ace::Grammar::Terminals
- Included in:
- Antelope::Ace::Grammar
- Defined in:
- lib/antelope/ace/grammar/terminals.rb
Overview
Manages a list of the terminals in the grammar.
Instance Method Summary collapse
-
#nonterminals ⇒ Array<Symbol>
A list of all nonterminals in the grammar.
-
#symbols ⇒ Array<Token::Terminal, Symbol>
A list of all symbols in the grammar; includes both terminals and nonterminals.
-
#terminals ⇒ Array<Token::Terminal>
A list of all terminals in the grammar.
Instance Method Details
#nonterminals ⇒ Array<Symbol>
A list of all nonterminals in the grammar.
27 28 29 |
# File 'lib/antelope/ace/grammar/terminals.rb', line 27 def nonterminals @_nonterminals ||= productions.keys end |
#symbols ⇒ Array<Token::Terminal, Symbol>
A list of all symbols in the grammar; includes both terminals and nonterminals.
37 38 39 |
# File 'lib/antelope/ace/grammar/terminals.rb', line 37 def symbols @_symbols ||= terminals + nonterminals end |
#terminals ⇒ Array<Token::Terminal>
A list of all terminals in the grammar. Checks the compiler options for terminals, and then returns an array of terminals. Caches the result.
15 16 17 18 19 20 21 |
# File 'lib/antelope/ace/grammar/terminals.rb', line 15 def terminals @_terminals ||= begin @compiler..fetch(:terminals, []).map do |v| Token::Terminal.new(*v) end end end |