Class: Jade::Parsing::UnexpectedTokenError
- Inherits:
-
Error
- Object
- Error
- Error
- Jade::Parsing::UnexpectedTokenError
show all
- Defined in:
- lib/jade/parsing/error.rb
Instance Attribute Summary
Attributes inherited from Error
#actual, #context, #expected
Instance Method Summary
collapse
Methods inherited from Error
#commit, #committed?, #with_context
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 message
"#{context_prefix}Unexpected token #{actual.value.inspect}, expected #{expected}#{" #{hint}" if hint}"
end
|