We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With logos 0.13.0
use logos::Logos; #[derive(Debug, PartialEq, Logos)] pub enum TokenKind { #[token(r"0b1")] ObiWan, #[token(".")] Dot, #[token("0")] Zero, #[regex(r"0b[0-1]+\.[0-1]+f")] BinFloat, } #[test] fn check() { let mut lexer = TokenKind::lexer("0b1.0"); assert_eq!(lexer.next(), Some(Ok(TokenKind::ObiWan))); assert_eq!(lexer.next(), Some(Ok(TokenKind::Dot))); assert_eq!(lexer.next(), Some(Ok(TokenKind::Zero))); assert_eq!(lexer.next(), None); }
This should lex 0b1.0 as [ObiWan, Dot, Zero], but instead immedatly errors
0b1.0
[ObiWan, Dot, Zero]
thread 'check' panicked at 'assertion failed: `(left == right)` left: `Some(Err(()))`, right: `Some(Ok(ObiWan))`', src/lib.rs:18:5
Either I don't understand the semantics, or this as a bug somewhere in the derive macro.
The text was updated successfully, but these errors were encountered:
An even simpler case:
use logos::Logos; #[derive(Debug, PartialEq, Logos)] pub enum TokenKind { #[token(r"AB")] AB, #[token(r"C")] C, #[regex(r"A[BC]+D")] Regex, } #[test] fn check() { let mut lexer = TokenKind::lexer("ABC"); assert_eq!(lexer.next(), Some(Ok(TokenKind::AB))); assert_eq!(lexer.next(), Some(Ok(TokenKind::C))); assert_eq!(lexer.next(), None); }
--- STDERR: logos-wat check --- thread 'check' panicked at 'assertion failed: `(left == right)` left: `Some(Err(()))`, right: `Some(Ok(AB))`', src/lib.rs:16:5
Sorry, something went wrong.
Same as #315 right? I'm having the same issue.
Yeah, Closing as duplicate.
No branches or pull requests
With logos 0.13.0
This should lex
0b1.0
as[ObiWan, Dot, Zero]
, but instead immedatly errorsEither I don't understand the semantics, or this as a bug somewhere in the derive macro.
The text was updated successfully, but these errors were encountered: