Class: Calyx::Production::Terminal

Inherits:
Object
  • Object
show all
Defined in:
lib/calyx/production/terminal.rb

Overview

A type of production rule that terminates with a resulting string atom.

Instance Method Summary collapse

Constructor Details

#initialize(atom) ⇒ Terminal

Construct a terminal node with the given value.

Parameters:

  • atom (#to_s)


8
9
10
# File 'lib/calyx/production/terminal.rb', line 8

def initialize(atom)
  @atom = atom
end

Instance Method Details

#evaluate(options) ⇒ Array

Evaluate the terminal by returning its identity directly.

Parameters:

Returns:

  • (Array)


16
17
18
# File 'lib/calyx/production/terminal.rb', line 16

def evaluate(options)
  [:atom, @atom]
end