class Safrano::Filter::ArgTree

Arguments or lists

Arguments or lists

Arguments or lists

Attributes

type[R]

Public Class Methods

new(val) click to toggle source
Calls superclass method Safrano::Filter::Tree::new
# File lib/odata/filter/tree.rb, line 288
def initialize(val)
  @type = :expression
  @state = :open
  super
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method Safrano::Filter::RootTree#==
# File lib/odata/filter/tree.rb, line 345
def ==(other)
  super(other) && @type == other.type && @state == other.state
end
accept?(tok, typ) click to toggle source

nil is considered as accepted, otherwise non-nil=the error

# File lib/odata/filter/tree.rb, line 306
def accept?(tok, typ)
  case typ
  when :Delimiter
    if @value == '(' && tok == ')' && @state != :closed
      if (@parent.class == IdentityFuncTree) or
         (@parent.arity_full?(@children.size))

        nil
      else
        Parser::ErrorInvalidArity.new(tok, typ, self)
      end
    else
      if @value == '(' && tok == '(' && @state == :open
        nil
      else
        Parser::ErrorUnmatchedClose.new(tok, typ, self)
      end
    end
  when :Separator
    if @value == '(' && tok == ',' && @state == :val
      nil
    elsif @state == :sep
      Parser::ErrorInvalidToken.new(tok, typ, self)
    end
  when :Literal, :NullLiteral, :Qualit, :QString, :FuncTree, :FPNumber
    if (@state == :open) || (@state == :sep)
      if @parent.arity_full?(@children.size)
        Parser::ErrorInvalidArity.new(tok, typ, self)
      end
    else
      Parser::ErrorInvalidToken.new(tok, typ, self)
    end
  when :BinopBool, :BinopArithm
    nil
  else
    Parser::ErrorInvalidToken.new(tok, typ, self)
  end
end
update_state(_tok, typ) click to toggle source
# File lib/odata/filter/tree.rb, line 294
def update_state(_tok, typ)
  case typ
  when :Delimiter
    @state = :closed
  when :Separator
    @state =  :sep
  when :Literal, :NullLiteral, :Qualit, :QString, :FuncTree, :FPNumber
    @state =  :val
  end
end