-
Notifications
You must be signed in to change notification settings - Fork 141
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
update Lexer to use Errors and add some support for C23 stuffs #489
Merged
Conversation
This file contains 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
- add variable annotation for 'name' field in '_formatter' class - fix runtime type checking in '__init__' of '_formatter' class - fix wrong type in 'json.dumps' calls that use 'separators' parameter with a string
- add 'add_error' method in 'Errors' class - add to repr of 'Errors' be the same than the inner list - add 'add_highlight' method in 'Error' dataclass
…edErrorsFormatter
Hello, I didn't review because of the 6/7 validated but is it over? |
Yes, it is |
matthieu42Network
approved these changes
Feb 28, 2024
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.
On progress
u
andu8
(Maybe) Add to support'
(sigle quote) to separate integers digitscast
calls to# type: ignore
assert
statementsErrors instead of Exceptions
I removed all exceptions from
Lexer
(I'm yet adding tests to make it no error-prone) and addedError
s instead, it will show more user-friendly error messages to users (and highlights soon). We don't need to stop the norminette when a float is correct in syntax but not in semantics (I added 8 errors about floats/integers).Alternative lexemes
Norminette will do some translations like
<%
and??<
toLBRACE
({
). Note that strings with digraphs and trigraphs will be translated as well like #486 did in comments.Escaped newline
This PRs is removing the
<ESCAPED_NEWLINE>
token, it means that codes using it will be buggy, likeCheckLineCount
(I pretend to fix it with others rules in a separated PR).Chars as Strings, Escape sequences
If the user writes a string with
'
(single quote) like'hello'
, it will see an error noticing it. Another cool thing is about writing bad escape sequences like\m
,\xGG
, etc. that will shows an error.Suffix in numeric literals
Added
i64
(Microsoft-specific),wb
(_BigInt(N)
) andz
(size_t
) suffixes for integer literals and for float literals:d*
(_DecimalN
) andi
withj
for complex literals (_Complex
).Others
test_lexer.py
TokenError
exception completly