Exception: Ibex::Runtime::ParseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/json5/generated_parser.rb

Overview

Raised by the default parser error handler.

Direct Known Subclasses

ResourceLimitError

Instance Attribute Summary collapse

Instance Method Summary collapse

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

RBS:

  • (?String? message, ?token_id: Integer?, ?token_name: String?, ?token_value: runtime_value, ?expected_tokens: Array[String], ?location: runtime_value, ?state: Integer?, ?suggestions: Array[String], ?error_id: String?, ?detail: String?) -> void



5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
# File 'lib/json5/generated_parser.rb', line 5702

def initialize(
  message = 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(message || diagnostic_message)
end

Instance Attribute Details

#error_idObject (readonly)

Signature:

  • String?



5697
5698
5699
# File 'lib/json5/generated_parser.rb', line 5697

def error_id
  @error_id
end

#expected_tokensObject (readonly)

Signature:

  • Array[String]



5693
5694
5695
# File 'lib/json5/generated_parser.rb', line 5693

def expected_tokens
  @expected_tokens
end

#locationObject (readonly)

Signature:

  • runtime_value



5694
5695
5696
# File 'lib/json5/generated_parser.rb', line 5694

def location
  @location
end

#stateObject (readonly)

Signature:

  • Integer?



5695
5696
5697
# File 'lib/json5/generated_parser.rb', line 5695

def state
  @state
end

#suggestionsObject (readonly)

Signature:

  • Array[String]



5696
5697
5698
# File 'lib/json5/generated_parser.rb', line 5696

def suggestions
  @suggestions
end

#token_idObject (readonly)

Signature:

  • Integer?



5690
5691
5692
# File 'lib/json5/generated_parser.rb', line 5690

def token_id
  @token_id
end

#token_nameObject (readonly)

Signature:

  • String?



5691
5692
5693
# File 'lib/json5/generated_parser.rb', line 5691

def token_name
  @token_name
end

#token_valueObject (readonly)

Signature:

  • runtime_value



5692
5693
5694
# File 'lib/json5/generated_parser.rb', line 5692

def token_value
  @token_value
end

Instance Method Details

#location_labelObject

RBS:

  • () -> String



5727
5728
5729
5730
5731
5732
# File 'lib/json5/generated_parser.rb', line 5727

def location_label
  file = location_value(:file) || "(input)"
  line = location_value(:line) || 1
  column = location_value(:column) || 1
  "#{file}:#{line}:#{column}"
end