Exception: RBS::ParsingError

Inherits:
ErrorBase
  • Object
show all
Defined in:
lib/rbs/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location, error_message, token_type) ⇒ ParsingError

Returns a new instance of ParsingError.



26
27
28
29
30
31
32
# File 'lib/rbs/errors.rb', line 26

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.



23
24
25
# File 'lib/rbs/errors.rb', line 23

def error_message
  @error_message
end

#locationObject (readonly)

Returns the value of attribute location.



22
23
24
# File 'lib/rbs/errors.rb', line 22

def location
  @location
end

#token_typeObject (readonly)

Returns the value of attribute token_type.



24
25
26
# File 'lib/rbs/errors.rb', line 24

def token_type
  @token_type
end

Instance Method Details

#error_valueObject



34
35
36
37
38
39
# File 'lib/rbs/errors.rb', line 34

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



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

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