Refactoring PEGjs files into smaller units #271
Merged
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.
This refactor breaks up the PEGjs files into many smaller units. It is a fairly substantial refactor, however I tried to minimize logic changes and renaming in order to preserve some continuity with the prior code.
The goal of this was:
#1 make the logic easier to understand.
#2 provide a good first step to adding angle-bracket support by abstracting some reusable elements.
This does come with a small penalty to build speed and file size since effectively a lot of code is duplicated at build time.
My approach was to first do several passes on the code trying to break it into smaller pieces. Then, the minimal amount of code was pushed up to the top level to prevent circular dependencies. The effect was that the top level file ends up being a good high level picture of the logic path, and is only 1/3 the LOC.
There is a lot more that could be done, especially in renaming and documentation. However, I wanted to push this up for some feedback to make sure this is heading in the right direction.
Also included are fixes for:
And this is based off of #270.