Class: Jade::Parsing::UnexpectedTokenError
- Defined in:
- lib/jade/parsing/error.rb
Instance Attribute Summary
Attributes inherited from Error
Attributes inherited from Error
Instance Method Summary collapse
- #hint ⇒ Object
-
#initialize(entry:, span:, actual:, expected:, committed: false, context: []) ⇒ UnexpectedTokenError
constructor
A new instance of UnexpectedTokenError.
- #label ⇒ Object
- #message ⇒ Object
Methods inherited from Error
#commit, #committed?, #with_context
Methods inherited from Error
#candidates, #notes, #queried_name, #to_diagnostic
Constructor Details
#initialize(entry:, span:, actual:, expected:, committed: false, context: []) ⇒ UnexpectedTokenError
Returns a new instance of UnexpectedTokenError.
57 58 59 |
# File 'lib/jade/parsing/error.rb', line 57 def initialize(entry:, span:, actual:, expected:, committed: false, context: []) super end |
Instance Method Details
#hint ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/jade/parsing/error.rb', line 61 def hint return leading_pipe_hint if leading_pipe_in_type_decl? return reserved_keyword_hint if reserved_keyword_as_name? return colon_not_eq_hint if eq_where_colon_expected? return record_eq_hint if eq_where_record_pipe_expected? nil end |
#label ⇒ Object
73 74 75 |
# File 'lib/jade/parsing/error.rb', line 73 def label "unexpected #{@actual.value.inspect}" end |
#message ⇒ Object
69 70 71 |
# File 'lib/jade/parsing/error.rb', line 69 def "#{context_prefix}Unexpected token #{actual.value.inspect}, expected #{expected}#{" #{hint}" if hint}" end |