Class: Prism::ParseError
- Inherits:
-
Object
- Object
- Prism::ParseError
- Defined in:
- lib/prism/parse_result.rb,
ext/prism/extension.c
Overview
This represents an error that was encountered during parsing.
Instance Attribute Summary collapse
-
#level ⇒ Object
readonly
The level of this error.
-
#location ⇒ Object
readonly
A Location object representing the location of this error in the source.
-
#message ⇒ Object
readonly
The message associated with this error.
-
#type ⇒ Object
readonly
The type of error.
Instance Method Summary collapse
-
#deconstruct_keys(keys) ⇒ Object
Implement the hash pattern matching interface for ParseError.
-
#initialize(type, message, location, level) ⇒ ParseError
constructor
Create a new error object with the given message and location.
-
#inspect ⇒ Object
Returns a string representation of this error.
Constructor Details
#initialize(type, message, location, level) ⇒ ParseError
Create a new error object with the given message and location.
607 608 609 610 611 612 |
# File 'lib/prism/parse_result.rb', line 607 def initialize(type, , location, level) @type = type @message = @location = location @level = level end |
Instance Attribute Details
#level ⇒ Object (readonly)
The level of this error.
604 605 606 |
# File 'lib/prism/parse_result.rb', line 604 def level @level end |
#location ⇒ Object (readonly)
A Location object representing the location of this error in the source.
601 602 603 |
# File 'lib/prism/parse_result.rb', line 601 def location @location end |
#message ⇒ Object (readonly)
The message associated with this error.
598 599 600 |
# File 'lib/prism/parse_result.rb', line 598 def @message end |
#type ⇒ Object (readonly)
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.
595 596 597 |
# File 'lib/prism/parse_result.rb', line 595 def type @type end |
Instance Method Details
#deconstruct_keys(keys) ⇒ Object
Implement the hash pattern matching interface for ParseError.
615 616 617 |
# File 'lib/prism/parse_result.rb', line 615 def deconstruct_keys(keys) { type: type, message: , location: location, level: level } end |
#inspect ⇒ Object
Returns a string representation of this error.
620 621 622 |
# File 'lib/prism/parse_result.rb', line 620 def inspect "#<Prism::ParseError @type=#{@type.inspect} @message=#{@message.inspect} @location=#{@location.inspect} @level=#{@level.inspect}>" end |