Class: Neg::Parser::SequenceParser

Inherits:
CompositeParser show all
Defined in:
lib/neg/parser.rb

Instance Method Summary collapse

Methods inherited from CompositeParser

#initialize

Methods inherited from SubParser

#*, #-@, #[], #parse, #|, #~

Constructor Details

This class inherits a constructor from Neg::Parser::CompositeParser

Instance Method Details

#+(pa) ⇒ Object



290
291
292
293
294
295
# File 'lib/neg/parser.rb', line 290

def +(pa)

  @children << pa

  self
end

#do_parse(i, opts) ⇒ Object



297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/neg/parser.rb', line 297

def do_parse(i, opts)

  results = []

  @children.each do |c|

    results << c.parse(i, opts)
    break unless results.last[2]
  end

  [ results.last[2], nil, results ]
end

#to_s(parent = nil) ⇒ Object



310
311
312
313
# File 'lib/neg/parser.rb', line 310

def to_s(parent=nil)

  "(#{@children.collect { |c| c.to_s(self) }.join(' + ')})"
end