Exception: Ibex::Runtime::ParseError
- Inherits:
-
StandardError
- Object
- StandardError
- Ibex::Runtime::ParseError
- Defined in:
- lib/ibex/runtime/parser.rb
Overview
Raised by the default parser error handler.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#error_id ⇒ Object
readonly
: String?.
-
#expected_tokens ⇒ Object
readonly
: Array.
-
#location ⇒ Object
readonly
: untyped.
-
#state ⇒ Object
readonly
: Integer?.
-
#suggestions ⇒ Object
readonly
: Array.
-
#token_id ⇒ Object
readonly
: Integer?.
-
#token_name ⇒ Object
readonly
: String?.
-
#token_value ⇒ Object
readonly
: untyped.
Instance Method Summary collapse
-
#initialize(message = nil, token_id: nil, token_name: nil, token_value: nil, expected_tokens: [], location: nil, state: nil, suggestions: [], error_id: nil, detail: nil) ⇒ ParseError
constructor
rubocop:disable Layout/LineLength rubocop:enable Layout/LineLength.
- #location_label ⇒ Object
Constructor Details
#initialize(message = nil, token_id: nil, token_name: nil, token_value: nil, expected_tokens: [], location: nil, state: nil, suggestions: [], error_id: nil, detail: nil) ⇒ ParseError
rubocop:disable Layout/LineLength rubocop:enable Layout/LineLength
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ibex/runtime/parser.rb', line 28 def initialize( = nil, token_id: nil, token_name: nil, token_value: nil, expected_tokens: [], location: nil, state: nil, suggestions: [], error_id: nil, detail: nil ) @token_id = token_id @token_name = token_name @token_value = token_value @expected_tokens = expected_tokens.dup.freeze @location = location @state = state @suggestions = suggestions.dup.freeze @error_id = error_id&.dup&.freeze @detail = detail super( || ) end |
Instance Attribute Details
#error_id ⇒ Object (readonly)
: String?
23 24 25 |
# File 'lib/ibex/runtime/parser.rb', line 23 def error_id @error_id end |
#expected_tokens ⇒ Object (readonly)
: Array
19 20 21 |
# File 'lib/ibex/runtime/parser.rb', line 19 def expected_tokens @expected_tokens end |
#location ⇒ Object (readonly)
: untyped
20 21 22 |
# File 'lib/ibex/runtime/parser.rb', line 20 def location @location end |
#state ⇒ Object (readonly)
: Integer?
21 22 23 |
# File 'lib/ibex/runtime/parser.rb', line 21 def state @state end |
#suggestions ⇒ Object (readonly)
: Array
22 23 24 |
# File 'lib/ibex/runtime/parser.rb', line 22 def suggestions @suggestions end |
#token_id ⇒ Object (readonly)
: Integer?
16 17 18 |
# File 'lib/ibex/runtime/parser.rb', line 16 def token_id @token_id end |
#token_name ⇒ Object (readonly)
: String?
17 18 19 |
# File 'lib/ibex/runtime/parser.rb', line 17 def token_name @token_name end |
#token_value ⇒ Object (readonly)
: untyped
18 19 20 |
# File 'lib/ibex/runtime/parser.rb', line 18 def token_value @token_value end |
Instance Method Details
#location_label ⇒ Object
53 54 55 56 57 58 |
# File 'lib/ibex/runtime/parser.rb', line 53 def location_label file = location_value(:file) || "(input)" line = location_value(:line) || 1 column = location_value(:column) || 1 "#{file}:#{line}:#{column}" end |