mirror of
https://github.com/danog/parser.git
synced 2024-11-30 04:29:13 +01:00
lexer: produce correct token for single !
This commit is contained in:
parent
c372b9e9bd
commit
e21b6a40ef
@ -187,7 +187,7 @@ impl Lexer {
|
||||
}
|
||||
[b'!', ..] => {
|
||||
self.next();
|
||||
TokenKind::BangEquals
|
||||
TokenKind::Bang
|
||||
}
|
||||
[b'&', b'&', ..] => {
|
||||
self.skip(2);
|
||||
|
@ -210,6 +210,7 @@ impl Default for Token {
|
||||
impl Display for TokenKind {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let s = match self {
|
||||
Self::BangEquals => "!=",
|
||||
Self::From => "from",
|
||||
Self::Print => "print",
|
||||
Self::BitwiseNot => "~",
|
||||
|
@ -2203,12 +2203,7 @@ impl Parser {
|
||||
prefix(&op, rhs)
|
||||
}
|
||||
TokenKind::Dollar => self.dynamic_variable()?,
|
||||
_ => todo!(
|
||||
"expr lhs: {:?}, line {} col {}",
|
||||
self.current.kind,
|
||||
self.current.span.0,
|
||||
self.current.span.1
|
||||
),
|
||||
_ => return Err(ParseError::UnexpectedToken(self.current.kind.to_string(), self.current.span)),
|
||||
};
|
||||
|
||||
if self.current.kind == TokenKind::SemiColon {
|
||||
|
Loading…
Reference in New Issue
Block a user