-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(PUP-7224) Replace Rgen AST model with one generated from Pcore
This commit adds the ast.rb file (generated from the ast.pp using the previously added rake task "gen_pcore_ast") and removes the Rgen based predecessor. Since the new model is immutable, this has consequences on two major areas. One is how offset, length, and the locator is handled and the other relates to how containers are accessed. In the old model, all expressions had a reference to their parent. This is very hard to achieve in a tree of immutable elements (parent would need to exist before the children that it is supposed to contain are created). In the new model, there is instead one common element that is referenced from every other element, and that is the Locator. Keeping a reference to the Locator is just a cheap as keeping a reference to a parent and it has the additional advantage of completely removing the need for SourcePosAdapters. An element that knows its locator, offset, and length, can respond directly to #file, #line, #pos using derived attributes. The lack of parent also prompted a change in the validator (it often consults the container of elements, and at times, needs to travererse all the way to the root). The solution for this was to let the corresponds to the current parent chain). That stack makes it possible for the validator to navigate the parents at all times.
- Loading branch information
Showing
45 changed files
with
6,046 additions
and
1,895 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
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
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
Oops, something went wrong.