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
Currently there's no way to fail with lexgen's "lexer error" when an error is detected. We need to specify a user error type, and fail using a value of that type.
It could be useful to provide a fail method in the lexers to fail with the standard "lexer error" error, without having to define an error type.
Use case: Rust string literals do not allow standalone carriage return, i.e. \r needs to be followed by \n.
We don't need another rule to make sure \r is always followed by \n. We can already do this today, but we have to define an error type and return an error: (not tested)
Currently there's no way to fail with lexgen's "lexer error" when an error is detected. We need to specify a user error type, and fail using a value of that type.
It could be useful to provide a
fail
method in the lexers to fail with the standard "lexer error" error, without having to define an error type.Use case: Rust string literals do not allow standalone carriage return, i.e.
\r
needs to be followed by\n
.One way to implement it is this:
If we had a
fail
method on lexer structs it could be slightly more concise:We don't need another rule to make sure
\r
is always followed by\n
. We can already do this today, but we have to define an error type and return an error: (not tested)The text was updated successfully, but these errors were encountered: