class Sparkql::ParserError

Attributes

constraint[W]
expression[RW]
message[RW]
nested_errors[RW]
recovered_as[RW]
sparkql[RW]
status[RW]
syntax[W]
token[RW]
token_index[RW]

Public Class Methods

new(error_hash={}) click to toggle source
# File lib/sparkql/errors.rb, line 45
def initialize(error_hash={})
  @token = error_hash[:token]
  @token_index = error_hash[:token_index]
  @expression = error_hash[:expression]
  @message = error_hash[:message]
  @status = error_hash[:status]
  @recovered_as = error_hash[:recovered_as]
  @recovered_as = error_hash[:recovered_as]
  @sparkql = error_hash[:sparkql]
  @nested_errors = error_hash[:nested_errors]
  self.syntax= error_hash[:syntax] == false ? false : true
  self.constraint= error_hash[:constraint] == true
end

Public Instance Methods

constraint?() click to toggle source
# File lib/sparkql/errors.rb, line 63
def constraint?
  @constraint
end
syntax?() click to toggle source
# File lib/sparkql/errors.rb, line 59
def syntax?
  @syntax
end
to_s() click to toggle source
# File lib/sparkql/errors.rb, line 67
def to_s
  str = case @status
        # Do nothing. Dropping the expressions isn't special
        when :dropped then "Dropped: " 
        # Fatal errors cannot be recovered from, and should cause anaylisis or
        # compilation to stop.
        when :fatal then "Fatal: "
        # Recovered errors are those that are syntatically
        # or symantically incorrect, but are ones that we could "guess" at the
        # intention
        when :recovered then
          "Recovered as #{@recovered_as}: "
        else ""
        end
  str += "<#{@token}> in " unless @token.nil?
  str += "<#{@expression}>: #{@message}."
  str
end