You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use logos::Logos;#[derive(Logos,Debug,Clone,Copy,PartialEq)]#[logos(skip r"[ \t]+")]#[logos(source = [u8])]pubenumToken{#[regex("-?(0[xob])?[0-9][0-9_]*")]Int,#[token("-")]Dash,}fnmain(){letmut lex = Token::lexer(b"-0x");assert_eq!(lex.next(),Some(Ok(Token::Dash)));assert_eq!(lex.slice(),b"-");// the slice is `-0`assert_eq!(lex.span(),0..1);// the span is `0..2`}
And test failed with the following message:
thread 'main' panicked at src/main.rs:16:5:
assertion `left == right` failed
left: [45, 48]
right: [45]
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I think the result is not right in the case, since the lexer correctly say the token is a Dash. It's impossible for the slice containing one more byte.
The text was updated successfully, but these errors were encountered:
Given the following code:
And test failed with the following message:
I think the result is not right in the case, since the lexer correctly say the token is a
Dash
. It's impossible for the slice containing one more byte.The text was updated successfully, but these errors were encountered: