Class: Cucumber::TagExpressions::Parser
- Inherits:
-
Object
- Object
- Cucumber::TagExpressions::Parser
- Defined in:
- lib/cucumber/tag_expressions/parser.rb
Instance Method Summary collapse
-
#initialize ⇒ Parser
constructor
A new instance of Parser.
- #parse(infix_expression) ⇒ Object
Constructor Details
#initialize ⇒ Parser
Returns a new instance of Parser.
8 9 10 11 |
# File 'lib/cucumber/tag_expressions/parser.rb', line 8 def initialize @expressions = [] @operators = [] end |
Instance Method Details
#parse(infix_expression) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cucumber/tag_expressions/parser.rb', line 13 def parse(infix_expression) expected_token_type = :operand tokens = tokenize(infix_expression) return True.new if tokens.empty? tokens.each { |token| expected_token_type = handle_sequential_tokens(token, infix_expression, expected_token_type) } while @operators.any? raise "Tag expression \"#{infix_expression}\" could not be parsed because of syntax error: Unmatched (." if @operators.last == '(' push_expression(infix_expression, @operators.pop) end @expressions.pop end |