Class: Rsec::Maybe
Overview
the content appears 1 or 0 time
Instance Attribute Summary
Attributes inherited from Unary
Attributes included from Parser
Instance Method Summary collapse
Methods included from Parser
#&, #*, #<<, #>>, #^, #cached, #eof, #fail, #inspect, #join, #map, #maybe, #parse, #parse!, #star, #|
Instance Method Details
#_parse(ctx) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/rsec/parsers/repeat.rb', line 5 def _parse ctx save = ctx.pos res = some._parse ctx if INVALID[res] ctx.pos = save [] else [res] end end |