MCPcopy Create free account
hub / github.com/dprint/jsonc-parser / unexpected_token_error

Method unexpected_token_error

src/parser.rs:111–121  ·  view source on GitHub ↗

Returns an error appropriate for an unexpected token.

(&self, token: &Token)

Source from the content-addressed store, hash-verified

109
110 /// Returns an error appropriate for an unexpected token.
111 pub fn unexpected_token_error(&self, token: &Token) -> ParseError {
112 let kind = match token {
113 Token::CloseBracket => ParseErrorKind::UnexpectedCloseBracket,
114 Token::CloseBrace => ParseErrorKind::UnexpectedCloseBrace,
115 Token::Comma => ParseErrorKind::UnexpectedComma,
116 Token::Colon => ParseErrorKind::UnexpectedColon,
117 Token::Word(_) => ParseErrorKind::UnexpectedWord,
118 _ => ParseErrorKind::UnexpectedToken,
119 };
120 self.scanner.create_error_for_current_token(kind)
121 }
122
123 /// Scans the next object entry (key or close brace), handling commas
124 /// between entries. Pass `first = true` for the first entry.

Callers 2

parse_valueFunction · 0.80
deserialize_tokenFunction · 0.80

Calls 1

Tested by

no test coverage detected