Skip to content

Commit 0d93af0

Browse files
committed
Report actual unexpected token in declarations.
1 parent b0c8cdf commit 0d93af0

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/parser.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ pub struct SourcePosition {
2525
pub enum BasicParseError<'a> {
2626
/// An unexpected token was encountered.
2727
UnexpectedToken(Token<'a>),
28-
/// A particular token was expected but not found.
29-
ExpectedToken(Token<'a>),
3028
/// The end of the input was encountered unexpectedly.
3129
EndOfInput,
3230
/// An `@` rule was encountered that was invalid.

src/rules_and_declarations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ where P: DeclarationParser<'i, Declaration = I, Error = E> +
257257
Ok(Token::AtKeyword(name)) => {
258258
return Some(parse_at_rule(start_position, name, self.input, &mut self.parser))
259259
}
260-
Ok(_) => {
260+
Ok(t) => {
261261
return Some(self.input.parse_until_after(Delimiter::Semicolon,
262-
|_| Err(ParseError::Basic(BasicParseError::ExpectedToken(Token::Semicolon))))
262+
|_| Err(ParseError::Basic(BasicParseError::UnexpectedToken(t))))
263263
.map_err(|e| PreciseParseError {
264264
error: e,
265265
span: start_position..self.input.position()

0 commit comments

Comments
 (0)