Class: DDQL::TokenType::NestedQuery

Inherits:
DDQL::TokenType show all
Defined in:
lib/ddql/token_type.rb

Constant Summary

Constants inherited from DDQL::TokenType

ALL, CURRENCY_LITERAL, FACTOR, FACTOR_PATTERN, INFIXOPERATOR, INTEGER_LITERAL, LBRACE, LPAREN, NESTED_CLOSER, NESTED_CLOSE_PATTERN, NESTED_OPENER, NESTED_OPEN_PATTERN, NUMERIC_LITERAL, POSTFIXOPERATOR, PREFIXOPERATOR, RBRACE, RPAREN, SCI_NUM_LITERAL, SCREEN, SPECIAL_MARKER, STRING_LITERAL, SUB_Q_ALIAS, SUB_Q_EXPR, SUB_Q_FIELDS, SUB_Q_GROUP, SUB_Q_TYPE, WHITESPACE

Instance Attribute Summary

Attributes inherited from DDQL::TokenType

#label, #name, #pattern

Instance Method Summary collapse

Methods inherited from DDQL::TokenType

#==, all_types_pattern, #comparison?, #data_from, #factor?, #group?, #infix?, #interpret, #interpreted_data_from, #literal?, #match?, #postfix?, #prefix?, #screen?, #skipping!, #supports_post_processing?, #trimming!

Constructor Details

#initializeNestedQuery

Returns a new instance of NestedQuery.



417
418
419
420
# File 'lib/ddql/token_type.rb', line 417

def initialize
  super(name: :nested_opener, pattern: Regexp.compile(Regexp.escape TokenType::NESTED_OPEN_PATTERN))
  trimming!
end

Instance Method Details

#as_hash(data) ⇒ Object



422
423
424
425
# File 'lib/ddql/token_type.rb', line 422

def as_hash(data)
  require 'pry'; binding.pry
  {screen: data.split('#').last.to_i}
end

#expression?Boolean

Returns:

  • (Boolean)


427
428
429
# File 'lib/ddql/token_type.rb', line 427

def expression?
  true
end

#parse(parser, token, expression: nil) ⇒ Object



431
432
433
434
435
# File 'lib/ddql/token_type.rb', line 431

def parse(parser, token, expression: nil)
  require 'pry'; binding.pry
  nested_parser = parser.class.from_tokens(parser.until(TokenType::NESTED_CLOSER))
  nested_parser.parse
end