-
Notifications
You must be signed in to change notification settings - Fork 74
[WIP] Fix issue 166 #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mesonbuild
Are you sure you want to change the base?
[WIP] Fix issue 166 #191
Conversation
by pip install .
enrich with file origine of the token. - Create the associated factory to instruct lexer to create token with our custom token The factory is responsible to use the file_line_map data. - Enrich CodePosition with fileName field.
This reverts commit a2c943d.
Tests are failing because hdlConvertorAst requiere an update of |
@Thomasb81 |
Refer to this class that need to be updated to add a fileName attribute. Having this python object definition in a different repository seems to create dependency circle ... it is not helping to do consistent change... I review this PR few day ago but have difficulties to remember I think new line in preprocessed code that does not come from source code is spotted in The codePosition object is currently fill with data issue from preprocessor buffer. So we lost the origin of token which are later use in case of error or directly report to user through codePosition object. The initial idea was to attach the origin filename to each token after preprocessing step so it serves all use-case without addition effort. Original Antlr token object : The idea would be to fix token data before they get used by the verilog/SV parser. To do so the idea is to use our customized token The verilog/SV Lexer is customize with our
That's where I stop, a little bit lost ... filename is probably correctly propagate, but I guess line are still wrong. Probably I miss understand FileLineMap data or did not figure out how to use them... That's why the PR is shared as is in draft in case someone want to have a look... |
Also here #134 (comment) you mention to use smart_prt. to reference fileName in codePosition. Current code make a copy. |
...Initial though was I can re-use
Better to have proper and dedicated data structure, that is able to store the origin ( file/str to parse, included file or macro expansion) of each chunk of code put in the output buffer. So |
Hello
Current draft push request is an attempt to fix : #166
First it remove new line added in preprocessing result. One part of the fix consist to make the preprocessing grammar to consume the training new line. The Ieee1800-2017 chapter 22.4 says
So we can remove new line on the line containing directive.
If included file does not end by new line, next line will appear on the last line from the included file. See tests/sv_pp/expected/include_many_dir/from_subdirectory.txt
Second part consist to enrich token build by antlr4 with original file location using
file_line_map
data.But the result is not yet correct: current data structure does not allow to retrieve all information we need for every lines.
The CodePosition object has been update to reflect the
fileName
data. hdlConvertorAst would also need to be updated.