Open jesopo opened 2 years ago
I feel like a better way to do this is to have a unary operator token that does the heuristics and then introduce a way for a token to say "scrap all other unfinished tokens" so it takes priority. that way only the unary operator token needs to know what a unary operator is and the unfinished regex token will just fall away
additional to the above, we could use that same priority system to prevent this
✨ ~/src/jess/scpl main % python3 -m scpl.parser ".1 + .1"
tokens : [Regex(.1 + .), Number(1)]
.1 + .1
^
parse error: missing operator
the gist of it being that a regex shouldn't know what its delimiters can't be because that list will get very long, but other tokens should be able to know what they individually get priority over