-
Notifications
You must be signed in to change notification settings - Fork 43
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
Fix ,-
parsing
#1277
Comments
@dm0n3y curious how the new system handles such cases. this is an awkward one in the current arrangement, as we have a notion of operator characters, where a (possibly user-defined soon) operator can consist of any run of those characters. there are a number of ways this categorization could be made more precise, but the case of characters which can be both prefix operators and parts of infix operators like this one seems pernicious. |
First thought is that comma is special in the same way parens/braces are and would not be included in the arbitrary operator token class |
@dm0n3y solves |
could try to restrict infix operators to not end in a token that can also be used as a prefix operator? |
@cyrus- could work but would involve some slightly grody intermediate states, e.g. is "-" was an operator then it goes from being one operator to two back to one again. could say more restrictively that prefix operator characters can't be used as non-initial characters in infix ops. i don't find the ocaml approach fully satisfying but the fact that they're doing it suggests it's at least annoying to do better |
@dm0n3y i feel like in principle there could be something analogous to your error-counting metric at the lexing level. an invalid token gets broken up if doing so results in a state with less total errors |
Yeah ultimately I think there should be character-level molding, which is what I really meant by context-informed lexing above. I agree with @disconcision that OCaml approach is not perfect but best bang for buck short of full solution. |
Current requires a space to separate the
,
and the-
.The text was updated successfully, but these errors were encountered: