Class: Rsec::SeqOne_
- Inherits:
-
Struct
- Object
- Struct
- Rsec::SeqOne_
- Includes:
- Parser
- Defined in:
- lib/rsec/parsers/seq.rb
Overview
skips skipper between tokens
Instance Attribute Summary collapse
-
#first ⇒ Object
Returns the value of attribute first.
-
#idx ⇒ Object
Returns the value of attribute idx.
-
#rest ⇒ Object
Returns the value of attribute rest.
-
#skipper ⇒ Object
Returns the value of attribute skipper.
Attributes included from Parser
Instance Method Summary collapse
Methods included from Parser
#&, #*, #<<, #>>, #^, #cached, #eof, #fail, #inspect, #join, #map, #maybe, #parse, #parse!, #star, #|
Instance Attribute Details
#first ⇒ Object
Returns the value of attribute first
51 52 53 |
# File 'lib/rsec/parsers/seq.rb', line 51 def first @first end |
#idx ⇒ Object
Returns the value of attribute idx
51 52 53 |
# File 'lib/rsec/parsers/seq.rb', line 51 def idx @idx end |
#rest ⇒ Object
Returns the value of attribute rest
51 52 53 |
# File 'lib/rsec/parsers/seq.rb', line 51 def rest @rest end |
#skipper ⇒ Object
Returns the value of attribute skipper
51 52 53 |
# File 'lib/rsec/parsers/seq.rb', line 51 def skipper @skipper end |
Instance Method Details
#_parse(ctx) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/rsec/parsers/seq.rb', line 54 def _parse ctx ret = INVALID res = first._parse ctx return INVALID if INVALID[res] ret = res if 0 == idx check = idx - 1 rest.each_with_index do |p, i| return INVALID if INVALID[skipper._parse ctx] res = p._parse ctx return INVALID if INVALID[res] ret = res if i == check end ret end |