class DDQL::TokenType::Factor

/Literals

Public Class Methods

new() click to toggle source
Calls superclass method DDQL::TokenType::new
# File lib/ddql/token_type.rb, line 211
def initialize
  super(name: :factor, pattern: FACTOR_PATTERN)
  trimming!
end

Public Instance Methods

as_hash(data) click to toggle source
# File lib/ddql/token_type.rb, line 216
def as_hash(data)
  {name => data}
end
factor?() click to toggle source
# File lib/ddql/token_type.rb, line 220
def factor?
  true
end
parse(parser, token, expression: nil) click to toggle source
# File lib/ddql/token_type.rb, line 224
def parse(parser, token, expression: nil)
  h = as_hash(token.data)
  parser.peek&.comparison? ? {left: h} : h
end