Class: Jade::Parsing::UnexpectedTokenError
- Defined in:
- lib/jade/parsing/error.rb
Constant Summary collapse
- COMMA_SEPARATED_BLOCKS =
Blocks whose entries are comma-separated, so a newline between two of them reads as the end of the block.
[ 'interop import declaration', 'interface declaration', 'implementation', ].freeze
Instance Attribute Summary
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
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
69 70 71 72 73 74 75 76 |
# File 'lib/jade/parsing/error.rb', line 69 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? return missing_comma_hint if entry_after_unterminated_entry? nil end |
#label ⇒ Object
82 83 84 |
# File 'lib/jade/parsing/error.rb', line 82 def label "unexpected #{@actual.value.inspect}" end |
#message ⇒ Object
78 79 80 |
# File 'lib/jade/parsing/error.rb', line 78 def "#{context_prefix}Unexpected token #{actual.value.inspect}, expected #{expected}#{" #{hint}" if hint}" end |