-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
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
Error handling #18
Comments
In its current state, the API is too generic to allow a useful stream wrapper. Consider the following language: moo.compile({
even: /(ab)+(?!a)/,
odd: /(ab)*a/,
}) Suppose the stream emits |
Wow, good point; I'd missed that. @Hardmath123 It sounds like we can't seamlessly integrate moo into nearley; at least not with proper feed() / Stream support. :(
Am I to read you don't like the API? You helped design it! :-) |
No, I do like the API! I was simply pointing out that it's incompatible with a stream API that doesn't re-lex the stream when it gets new data. If you leave the task of pushing data only at token boundaries up to the user, then it's easy to add a stream interface (that's what It's also possible, I guess, to re-lex the last token when we get new data, but you can still break this if you have two tokens which, when concatenated, form a different token; and this makes the API weird because you need to sometimes return a token twice. |
Fixed by #25 |
Currently, if the lexer finds an error, it returns a single
ERRORTOKEN
containing the whole of the rest of the buffer. This is suboptimal:ERRORTOKEN
is hard-coded (taken from Python). We probably want it user-customisable.Other considerations:
The text was updated successfully, but these errors were encountered: