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
: runtime_value.
-
#state ⇒ Object
readonly
: Integer?.
-
#suggestions ⇒ Object
readonly
: Array.
-
#token_id ⇒ Object
readonly
: Integer?.
-
#token_name ⇒ Object
readonly
: String?.
-
#token_value ⇒ Object
readonly
: runtime_value.
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
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/ibex/runtime/parser.rb', line 62 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?
57 58 59 |
# File 'lib/ibex/runtime/parser.rb', line 57 def error_id @error_id end |
#expected_tokens ⇒ Object (readonly)
: Array
53 54 55 |
# File 'lib/ibex/runtime/parser.rb', line 53 def expected_tokens @expected_tokens end |
#location ⇒ Object (readonly)
: runtime_value
54 55 56 |
# File 'lib/ibex/runtime/parser.rb', line 54 def location @location end |
#state ⇒ Object (readonly)
: Integer?
55 56 57 |
# File 'lib/ibex/runtime/parser.rb', line 55 def state @state end |
#suggestions ⇒ Object (readonly)
: Array
56 57 58 |
# File 'lib/ibex/runtime/parser.rb', line 56 def suggestions @suggestions end |
#token_id ⇒ Object (readonly)
: Integer?
50 51 52 |
# File 'lib/ibex/runtime/parser.rb', line 50 def token_id @token_id end |
#token_name ⇒ Object (readonly)
: String?
51 52 53 |
# File 'lib/ibex/runtime/parser.rb', line 51 def token_name @token_name end |
#token_value ⇒ Object (readonly)
: runtime_value
52 53 54 |
# File 'lib/ibex/runtime/parser.rb', line 52 def token_value @token_value end |
Instance Method Details
#location_label ⇒ Object
87 88 89 90 91 92 |
# File 'lib/ibex/runtime/parser.rb', line 87 def location_label file = location_value(:file) || "(input)" line = location_value(:line) || 1 column = location_value(:column) || 1 "#{file}:#{line}:#{column}" end |