Class: DecisionAgent::Dmn::Feel::Parser

Inherits:
Parslet::Parser
  • Object
show all
Defined in:
lib/decision_agent/dmn/feel/parser.rb

Overview

Parslet-based FEEL 1.3 expression parser Implements full FEEL grammar including:

  • Literals (numbers, strings, booleans, null)
  • Lists and contexts
  • Arithmetic, comparison, and logical operators
  • Function calls
  • Property access and path expressions
  • Quantified expressions (some/every)
  • For expressions
  • If/then/else conditionals
  • Ranges and intervals

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse_expression(input) ⇒ Object

Parse with error handling (class method for backward compatibility)



339
340
341
342
343
344
345
346
347
# File 'lib/decision_agent/dmn/feel/parser.rb', line 339

def self.parse_expression(input)
  new.parse(input)
rescue Parslet::ParseFailed => e
  error_msg = "Failed to parse FEEL expression: #{e.parse_failure_cause.ascii_tree}"
  error = FeelParseError.new(error_msg)
  error.instance_variable_set(:@expression, input)
  error.instance_variable_set(:@position, 0)
  raise error
end

Instance Method Details

#parse(input) ⇒ Object

Instance method for parsing with error handling



328
329
330
331
332
333
334
335
336
# File 'lib/decision_agent/dmn/feel/parser.rb', line 328

def parse(input)
  super
rescue Parslet::ParseFailed => e
  error_msg = "Failed to parse FEEL expression: #{e.parse_failure_cause.ascii_tree}"
  error = FeelParseError.new(error_msg)
  error.instance_variable_set(:@expression, input)
  error.instance_variable_set(:@position, 0)
  raise error
end