class Autoproj::RosConditionParser
Parses a conditional expression Syntax and rules as defined in www.ros.org/reps/rep-0149.html#id20
Constants
- RESERVED
Public Class Methods
Source
# File lib/autoproj/ros_condition_parser.rb, line 11 def initialize(&expander) @expander = expander super() end
Calls superclass method
Public Instance Methods
Source
# File lib/autoproj/ros_condition_parser.rb, line 35 def any_of(strings) strings = strings.dup strings.reduce(str(strings.shift)) { |acc, s| acc | str(s) } end
Source
# File lib/autoproj/ros_condition_parser.rb, line 46 def chain(lhs, operator, operation) (lhs.as(:lhs) >> operator >> operation.as(:rhs)) | lhs end
Source
# File lib/autoproj/ros_condition_parser.rb, line 29 def evaluate(expr) Transform.new.apply(parse(expr.strip), expander: method(:expand)) rescue Parslet::ParseFailed => e raise Autoproj::ConfigError, e.message end
Source
# File lib/autoproj/ros_condition_parser.rb, line 16 def expand(var) @expander.call(var) end
Source
# File lib/autoproj/ros_condition_parser.rb, line 40 def quoted_literal(quote) str(quote) >> ( str(quote).absent? >> any ).repeat.maybe.as(:literal) >> str(quote) end