Repository navigation
fix(lexer): end an operator where the next token starts - #21
Merged
Merged
Conversation
Contributor
Author
|
All tests pass when the locale is pinned to en_US: ❯ LC_ALL=en_US.UTF-8 ./build/numen-tests
Randomness seeded to: 4223859856
===============================================================================
All tests passed (14812 assertions in 93 test cases) |
Contributor
|
thx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Discovered this while daily driving Vicinae using Numen backend on the launcher too. FWIW, some of these do and don't happen on SoulverCore (the other backend option on Vicinae).
The Operator state only ended on a digit, ASCII letter or space, so anything else that starts a token got glued onto the operator.
3*.3became3+"*."+3. Same for$, quotes and UTF-8 (3*$5,2*"a",3*€2).In the REPL
3*.3silently returns3. On the launcher you see no result at all, since Vicinae runs Numen in strict mode.While lexing an operator, each next char either continues it (
**,<=) or ends it:#10 covered chars that are operators on their own. This covers chars that start a different token (number, word, string), i.e. anything Reset wouldn't route to Operator.
Testing
Added to
tests/corpus/arithmetic.corpus, after the leading-zero section:main vs this branch:
Other cases on this branch:
2*"a"and2*πnow error instead of silently returning2; the spaced forms error the same way.aedis from my machine's region (UAE) via implicit currency conversion, same as3 * $5.numen-tests: all new assertions pass. 3 currency tests fail on bothmainand this branch withNo conversion rate available for aed., for the same region reason. Unrelated to this change.