Class
This represents an error that was encountered during parsing.
Attributes
Read
The type of error. This is an internal symbol that is used for communicating with translation layers. It is not meant to be public API.
Read
The message associated with this error.
Read
The level of this error.
Class Methods
lib/prism/parse_result.rb
View on GitHub
# File tmp/rubies/ruby-3.4.0-preview1/lib/prism/parse_result.rb, line 466
def initialize(type, message, location, level)
@type = type
@message = message
@location = location
@level = level
end
Create a new error object with the given message and location.
Instance Methods
lib/prism/parse_result.rb
View on GitHub
# File tmp/rubies/ruby-3.4.0-preview1/lib/prism/parse_result.rb, line 474
def deconstruct_keys(keys)
{ type: type, message: message, location: location, level: level }
end
Implement the hash pattern matching interface for ParseError
.
#
lib/prism/parse_result.rb
View on GitHub
# File tmp/rubies/ruby-3.4.0-preview1/lib/prism/parse_result.rb, line 479
def inspect
"#<Prism::ParseError @type=#{@type.inspect} @message=#{@message.inspect} @location=#{@location.inspect} @level=#{@level.inspect}>"
end
Returns a string representation of this error.