[parser] Refactor parser to use tokenization.#4
Open
V-FEXrt wants to merge 1 commit intoZackFreedman:mainfrom
Open
[parser] Refactor parser to use tokenization.#4V-FEXrt wants to merge 1 commit intoZackFreedman:mainfrom
V-FEXrt wants to merge 1 commit intoZackFreedman:mainfrom
Conversation
Refactors parser to process source string as token list. Fixes a number of small bugs, adds a couple small features, and adds a bunch of test cases to keep the language running
V-FEXrt
commented
Nov 9, 2021
| @@ -1,7 +1,4 @@ | |||
| import usb_hid | |||
| import time | |||
| import supervisor | |||
Author
There was a problem hiding this comment.
I don't know if it is actually safe to delete these here. I needed to remove them to run the test code on my host machine. Removing them didn't seem to break anything but that might not be the case on the real keyboard and needs to be tested/confirmed
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.
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+0xFFTesting
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.pyortime python3 Firmware/parser_test.pyfor timing stats