Exception: RBS::ParsingError

Inherits:
BaseError
  • Object
show all
Includes:
DetailedMessageable
Defined in:
lib/rbs/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DetailedMessageable

#detailed_message

Constructor Details

#initialize(location, error_message, token_type) ⇒ ParsingError

Returns a new instance of ParsingError.



46
47
48
49
50
51
52
# File 'lib/rbs/errors.rb', line 46

def initialize(location, error_message, token_type)
  @location = location
  @error_message = error_message
  @token_type = token_type

  super "#{Location.to_string location}: Syntax error: #{error_message}, token=`#{location.source}` (#{token_type})"
end

Instance Attribute Details

#error_messageObject (readonly)

Returns the value of attribute error_message.



43
44
45
# File 'lib/rbs/errors.rb', line 43

def error_message
  @error_message
end

#locationObject (readonly)

Returns the value of attribute location.



42
43
44
# File 'lib/rbs/errors.rb', line 42

def location
  @location
end

#token_typeObject (readonly)

Returns the value of attribute token_type.



44
45
46
# File 'lib/rbs/errors.rb', line 44

def token_type
  @token_type
end

Instance Method Details

#error_valueObject



54
55
56
57
58
59
# File 'lib/rbs/errors.rb', line 54

def error_value
  RBS.print_warning {
    "#{self.class.name}#error_value is deprecated and will be deleted in RBS 2.0. Consider using `location.source` instead."
  }
  location.source
end

#token_strObject



61
62
63
64
65
66
# File 'lib/rbs/errors.rb', line 61

def token_str
  RBS.print_warning {
    "#{self.class.name}#token_str is deprecated and will be deleted in RBS 2.0. Consider using `token_type` instead."
  }
  token_type
end