Class: Neg::Parser::AlternativeParser
Instance Method Summary
collapse
#initialize
Methods inherited from SubParser
#*, #+, #[], #parse
Instance Method Details
#do_parse(i) ⇒ Object
299
300
301
302
303
304
305
306
307
308
309
|
# File 'lib/neg/parser.rb', line 299
def do_parse(i)
result = []
@children.each { |c|
result << c.parse(i)
break if result.last[1]
}
[ result.last[1], result ]
end
|
#to_s(parent = nil) ⇒ Object
311
312
313
314
|
# File 'lib/neg/parser.rb', line 311
def to_s(parent=nil)
"(#{@children.collect { |c| c.to_s(self) }.join(' | ')})"
end
|
#|(pa) ⇒ Object
292
293
294
295
296
297
|
# File 'lib/neg/parser.rb', line 292
def |(pa)
@children << pa
self
end
|