Class: Fabulator::Grammar::Expr::NegLookAhead
- Inherits:
-
Object
- Object
- Fabulator::Grammar::Expr::NegLookAhead
- Defined in:
- lib/fabulator/grammar/expr/look_ahead.rb
Instance Method Summary collapse
-
#initialize(sequence) ⇒ NegLookAhead
constructor
A new instance of NegLookAhead.
- #name ⇒ Object
- #parse(source) ⇒ Object
Constructor Details
#initialize(sequence) ⇒ NegLookAhead
Returns a new instance of NegLookAhead.
24 25 26 |
# File 'lib/fabulator/grammar/expr/look_ahead.rb', line 24 def initialize(sequence) @sequence = sequence end |
Instance Method Details
#name ⇒ Object
28 29 30 |
# File 'lib/fabulator/grammar/expr/look_ahead.rb', line 28 def name nil end |
#parse(source) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/fabulator/grammar/expr/look_ahead.rb', line 32 def parse(source) ret = false source.attempt do |c| ret = @sequence.parse(c) raise Fabulator::Grammar::RejectParse end raise Fabulator::Grammar::RejectParse if ret end |