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.
25 26 27 |
# File 'lib/antelope/ace/grammar/terminals.rb', line 25 def nonterminals @_nonterminals ||= productions.keys end |
#symbols ⇒ Array<Token::Terminal, Symbol>
A list of all symbols in the grammar; includes both terminals and nonterminals.
35 36 37 |
# File 'lib/antelope/ace/grammar/terminals.rb', line 35 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.
13 14 15 16 17 18 19 |
# File 'lib/antelope/ace/grammar/terminals.rb', line 13 def terminals @_terminals ||= begin @compiler..fetch(:terminals, []).map do |v| Token::Terminal.new(*v) end end end |