Class: Sakuramochi::Condition::Parser
- Inherits:
-
Object
- Object
- Sakuramochi::Condition::Parser
- Defined in:
- lib/sakuramochi/condition.rb
Overview
expression = term term term = [“not”] factor factor = array | hash | “(” expression “)”
Constant Summary collapse
- EXPRESSIONS =
['and', 'or']
- TERMS =
['not']
- PARENTHESES =
{'(' => ')'}
Instance Method Summary collapse
-
#initialize(tokens) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(tokens) ⇒ Parser
Returns a new instance of Parser.
66 67 68 69 70 |
# File 'lib/sakuramochi/condition.rb', line 66 def initialize(tokens) @tokens = tokens.dup @tokens = @tokens.split(/\s+/) if @tokens.is_a?(String) # debug @tokens = [@tokens] unless @tokens.is_a?(Array) end |
Instance Method Details
#parse ⇒ Object
72 73 74 |
# File 'lib/sakuramochi/condition.rb', line 72 def parse expression end |