-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update Lexer to use Errors and add some support for C23 stuffs (#489)
* fix types related to error formatters - 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 to 'col' parameter in 'NormWarning' and 'NormError' classes to not be optional * add to 'Error' and 'Highlight' dataclasses to be sortable * add to 'level' and 'highlights' field of 'Error' dataclass be optional * add 'from_name' constructor for 'Error' dataclass * fix opening bad file paths when source is empty in File class * add to Token class be a dataclass * improve 'Errors' and 'Error' classes with QoL - 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 * fix 'Error.text' field being override to 'Error not found' in HumanizedErrorsFormatter * fix unexpected errors in Lexer.pop that is expected a raise UnexpectedEOF * add 'use_escape' parameter in 'Lexer.pop' method * refactor Lexer to use errors instead of Exceptions to be more descritive * add to support digraphs and trigraphs when parsing an operator * add 'Lexer.peek' tests * add removed preproc tests * add tests for floats with fractional part * remove asserts in Lexer * add complex suffix for float literals * add to support u and u8 prefixes for chars and strings * add to parse hexadecimal floats * add to handle multiple '.' and 'x' in float literals * fix test_errors * fix Lexer.get_next_token type of self.__pos * fix types in rule.py * move 'lexer_from_source()' and 'dict_to_pytest_param()' to tests/utils.py
- Loading branch information
Showing
29 changed files
with
1,257 additions
and
1,052 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
from norminette.lexer.lexer import Lexer | ||
from norminette.lexer.lexer import TokenError | ||
from norminette.lexer.tokens import Token | ||
|
||
__all__ = ["Lexer", "TokenError", "Token"] | ||
__all__ = ["Lexer", "Token"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,7 @@ | |
">>": "RIGHT_SHIFT", | ||
"<<": "LEFT_SHIFT", | ||
"?": "TERN_CONDITION", | ||
"#": "HASH", | ||
} | ||
|
||
brackets = { | ||
|
Oops, something went wrong.