Class: Mutant::Expression::Parser
- Inherits:
-
Object
- Object
- Mutant::Expression::Parser
- Defined in:
- lib/mutant/expression/parser.rb
Defined Under Namespace
Classes: AmbiguousExpressionError, InvalidExpressionError, ParserError
Instance Method Summary collapse
-
#call(input) ⇒ Expression
private
Parse input into expression or raise.
-
#try_parse(input) ⇒ Expression?
private
Try to parse input into expression.
Instance Method Details
#call(input) ⇒ Expression
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parse input into expression or raise
27 28 29 |
# File 'lib/mutant/expression/parser.rb', line 27 def call(input) try_parse(input) or fail InvalidExpressionError, "Expression: #{input.inspect} is not valid" end |
#try_parse(input) ⇒ Expression?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Try to parse input into expression
42 43 44 45 46 47 48 49 50 |
# File 'lib/mutant/expression/parser.rb', line 42 def try_parse(input) expressions = expressions(input) case expressions.length when 0, 1 expressions.first else fail AmbiguousExpressionError, "Ambiguous expression: #{input.inspect}" end end |