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

Instance Method Details

#nonterminalsArray<Symbol>

A list of all nonterminals in the grammar.

Returns:

  • (Array<Symbol>)

See Also:



25
26
27
# File 'lib/antelope/ace/grammar/terminals.rb', line 25

def nonterminals
  @_nonterminals ||= productions.keys
end

#symbolsArray<Token::Terminal, Symbol>

A list of all symbols in the grammar; includes both terminals and nonterminals.

Returns:

See Also:



35
36
37
# File 'lib/antelope/ace/grammar/terminals.rb', line 35

def symbols
  @_symbols ||= terminals + nonterminals
end

#terminalsArray<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.

Returns:



13
14
15
16
17
18
19
# File 'lib/antelope/ace/grammar/terminals.rb', line 13

def terminals
  @_terminals ||= begin
    @compiler.options.fetch(:terminals, []).map do |v|
      Token::Terminal.new(*v)
    end
  end
end