Exception: MilkTea::ParseError
- Inherits:
-
StandardError
- Object
- StandardError
- MilkTea::ParseError
- Defined in:
- lib/milk_tea/core/parser.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #code ⇒ Object
- #column ⇒ Object
-
#initialize(message, token:, path: nil) ⇒ ParseError
constructor
A new instance of ParseError.
- #line ⇒ Object
Constructor Details
#initialize(message, token:, path: nil) ⇒ ParseError
Returns a new instance of ParseError.
15 16 17 18 19 20 21 |
# File 'lib/milk_tea/core/parser.rb', line 15 def initialize(, token:, path: nil) @token = token @path = path location = [path, "#{token.line}:#{token.column}"].compact.join(":") super(location.empty? ? : "#{} at #{location}") end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
13 14 15 |
# File 'lib/milk_tea/core/parser.rb', line 13 def path @path end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
13 14 15 |
# File 'lib/milk_tea/core/parser.rb', line 13 def token @token end |
Instance Method Details
#code ⇒ Object
31 32 33 |
# File 'lib/milk_tea/core/parser.rb', line 31 def code "parse/error" end |
#column ⇒ Object
27 28 29 |
# File 'lib/milk_tea/core/parser.rb', line 27 def column @token.column end |
#line ⇒ Object
23 24 25 |
# File 'lib/milk_tea/core/parser.rb', line 23 def line @token.line end |