logos
logos copied to clipboard
Create ridiculously fast Lexers
## Stack overflow This causes a stack overflow: ```rust use logos::Logos; #[derive(Logos, Debug, PartialEq)] enum Token { // This is one way to deal with strings with escaped quotes. //...
Code: ```{rust} #[derive(Logos)] enum Token { #[regex(r".*->.+\[", logos::skip)] #[error] Error, #[regex(r"->")] Arrow, } ``` Got this error: `Merging two reserved nodes! This is a bug, please report it: ...` Reporting...
In short, instead of passing a token or regex pattern, I want to pass a function that would return Option. such as: ```rust #[derive(Logos)] enum Keyword { #[token(let)] Let, #[token(if)]...
It seems that the passed regular expression, even if it does not make use of advanced features, is not correctly interpreted. Hi, here is a simplified example of my code...
If you define a token like this: ``` #[derive(Logos)] enum Token { #[token("xx")] Specific, #[regex(r"(xx+|y)+")] Generic, #[error] Error, } ``` the derive macro will fail with a segfault.
```rs #[derive(Logos, Debug, PartialEq)] enum Token { #[regex(r"[ab]*a")] Foo, // #[regex(r"[ab]+")] // Bar, #[error] Error, } ``` The above returns a single `Error` when fed the input "aba" *unless* `Bar`...
I'm expecting the regular expression string to return the values inside the parentheses () similar to perl 's $1 so for a string of: ```my_label:``` I expect ``` #[regex("([[:word:]]+):",lcaseit, ignore(ascii_case)...
The following program: ``` use logos::Logos; #[derive(Debug, Logos, PartialEq)] pub(crate) enum Token
regexs are used to match stuff, but in for example a callback function you only get access to the raw string/slice, so one would have to reparse the entire string...
This program: ``` use logos::{Logos, Lexer}; #[derive(Logos, Debug, PartialEq)] pub enum Token