-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Associate AST elements with tokens (#211)
* Implement get_token_id using a Token as parameter and rename the old implementation * Add the trait TokenSpan which will annotate AST elements with a span of tokens The macros `with_token_span` and `TokenSpan` of the newly added crate `vhdl_lang_macros` automatically implement this trait for structs with named fields. * Apply the `with_token_span` and `TokenSpan` macros to some AST elements Namely: TypeDeclaration, ObjectDeclaration, ProcedureSpecification, FunctionSpecification, SubprogramInstantiation, SubprogramDeclaration, LibraryClause, UseClause, ContextReference and ContextItem * Introduce a new AST element SubprogramSpecification, and remove Option<> from the TokenSpan trait A SubprogramSpecification is the sole field of SubprogramDeclarations but with a different meaning and a different token span. * Apply the TokenSpan macros to further AST elements The affected elements include: - Declaration (and all its subelements) - AnyPrimaryUnit (and all its subelements) - AnySecondaryUnit (and all its subelements) - AnyDesignUnit Small changes to the parsing of file declarations were done for easier handling and to better represent the official VHDL grammar * Update version of vhdl_lang_macros crate * Remove unused function get_token_id * Rename TokenSpan related fields and structs and introduce helper functions for unit tests For consistency reasons rename the trait TokenSpan to HasTokenSpan and the struct TokenInfo to TokenSpan. Furthermore, rename the info field to span. * Remove TokenSpan from subprogram specifications * Change tests regarding file declarations to test if the parser recovers successfully when encountering errors * Introduce helper functions to cut down the size of some subprogram unit tests * Rename FoundDeclaration::SubprogramSpec and remove visitor functions for subprogram specifications
- Loading branch information
Showing
32 changed files
with
1,508 additions
and
484 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.