[parser] Refactor parser to use tokenization. #4
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.
Summary
Replaces the parser with a token based parser. This allows for easier changes and additions to the language. It allow allows for easy fixes for the "comma in string" bug. This change also fixes small typos found in other parts of the firmware
Features
For the most part this should be a drop in replacement for the previous parser. The only known changes are listed below
[COMMA]
=>,
substitution has been removed as it is redundant now[RETURN]
and[SINGLE QUOTE]
have been added as substitutionsR0, K0: 0x01+0x02+0xFF
Testing
This feature was not tested on real hardware (I haven't build the keeb yet :) ) but the code maintains the previous implementations public interface (via
parse_layer_definition()
) and the language itself is thoroughly tested to ensure correctnessThe test can be ran with
python3 Firmware/parser_test.py
ortime python3 Firmware/parser_test.py
for timing stats