Class: Packrat::SexprProducer

Inherits:
ResultProducer show all
Defined in:
lib/packrat/grammar.rb

Overview

Create a Sexpr based on the name of the matched production and the result-array.

Instance Method Summary collapse

Methods inherited from ResultProducer

#finalize_result, #production=

Constructor Details

#initialize(name) ⇒ SexprProducer

Returns a new instance of SexprProducer.



256
257
258
# File 'lib/packrat/grammar.rb', line 256

def initialize(name)
  @name = name
end

Instance Method Details

#new_resultObject



259
# File 'lib/packrat/grammar.rb', line 259

def new_result; [@name]; end

#update_result(res, subres, elem, index, nhi) ⇒ Object



260
# File 'lib/packrat/grammar.rb', line 260

def update_result(res, subres, elem, index, nhi); res << subres; end