Module: L43Peg::Helper

Included in:
Combinators, Combinators::Many, Combinators::Sel, Combinators::Seq
Defined in:
lib/l43_peg/helper.rb

Instance Method Summary collapse

Instance Method Details

#fail_parser(reason, input: nil) ⇒ Object



5
6
7
# File 'lib/l43_peg/helper.rb', line 5

def fail_parser(reason, input: nil)
  L43Peg::Failure.new(reason:, input:)
end

#succeed_parser(ast, input, cache: nil) ⇒ Object



8
9
10
# File 'lib/l43_peg/helper.rb', line 8

def succeed_parser(ast, input, cache: nil)
  L43Peg::Success.new(ast:, rest: input, cache: cache || input.cache)
end