Class: Dogfood::DSL::Evaluator::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/dogfood/dsl/evaluator.rb

Overview

Recursive-descent parser for the expression grammar.

Instance Method Summary collapse

Constructor Details

#initialize(input, bindings:, state:, rng:, self_object: nil) ⇒ Parser

Returns a new instance of Parser.



52
53
54
55
56
57
58
59
# File 'lib/dogfood/dsl/evaluator.rb', line 52

def initialize(input, bindings:, state:, rng:, self_object: nil)
  @input = input.strip
  @pos = 0
  @bindings = bindings
  @state = state
  @rng = rng
  @self_object = self_object
end

Instance Method Details

#parseObject



61
62
63
64
65
66
# File 'lib/dogfood/dsl/evaluator.rb', line 61

def parse
  result = parse_comparison
  skip_ws
  raise_error("unexpected trailing input") unless eof?
  result
end