Class: Odin::Transform::Expr::Parser
- Inherits:
-
Object
- Object
- Odin::Transform::Expr::Parser
- Defined in:
- lib/odin/transform/transform_expr.rb
Instance Method Summary collapse
-
#initialize(tokens, binding_path) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(tokens, binding_path) ⇒ Parser
Returns a new instance of Parser.
108 109 110 111 112 |
# File 'lib/odin/transform/transform_expr.rb', line 108 def initialize(tokens, binding_path) @tokens = tokens @binding_path = binding_path @pos = 0 end |
Instance Method Details
#parse ⇒ Object
114 115 116 117 118 119 |
# File 'lib/odin/transform/transform_expr.rb', line 114 def parse raise ExprSyntaxError, "empty formula" if @tokens.empty? expr = parse_additive raise ExprSyntaxError, "unexpected token '#{peek.value}'" if @pos < @tokens.length expr end |