Class: SQLTree::Node::Expression
- Defined in:
- lib/active_record/turntable/sql_tree_patch.rb
Direct Known Subclasses
Defined Under Namespace
Classes: BinaryOperator, EscapedValue, Field, PrefixOperator, Value
Class Method Summary collapse
Methods inherited from Base
Class Method Details
.parse_atomic(tokens) ⇒ Object
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'lib/active_record/turntable/sql_tree_patch.rb', line 329 def self.parse_atomic(tokens) if SQLTree::Token::LPAREN === tokens.peek tokens.consume(SQLTree::Token::LPAREN) expr = self.parse(tokens) tokens.consume(SQLTree::Token::RPAREN) expr elsif tokens.peek.prefix_operator? PrefixOperator.parse(tokens) elsif tokens.peek.variable? if SQLTree::Token::LPAREN === tokens.peek(2) FunctionCall.parse(tokens) elsif SQLTree::Token::DOT === tokens.peek(2) Field.parse(tokens) else Variable.parse(tokens) end elsif SQLTree::Token::STRING_ESCAPE == tokens.peek EscapedValue.parse(tokens) elsif SQLTree::Token::BINARY_ESCAPE == tokens.peek EscapedValue.parse(tokens) elsif SQLTree::Token::INTERVAL === tokens.peek IntervalValue.parse(tokens) else Value.parse(tokens) end end |