Parse pluscal labels inserted due to macro#353
Merged
FedericoPonzi merged 2 commits intotlaplus:masterfrom Dec 20, 2024
Merged
Conversation
Signed-off-by: Hillel <h@hillelwayne.com>
hwayne
commented
Dec 12, 2024
src/parsers/pluscal.ts
Outdated
| } | ||
|
|
||
| const matcher = /^\s\s([A-Za-z0-9_]+) at line \d+, column \d+$/g.exec(line); | ||
| const matcher = /^\s\s([A-Za-z0-9_]+) at line \d+, column \d+/g.exec(line); |
Contributor
Author
There was a problem hiding this comment.
Note the removal of the $ at the end, so it will match as long as the string has matcher as a prefix. This is only called if we're in label parsing mode so won't affect parsing any other output.
hwayne
commented
Dec 12, 2024
src/parsers/pluscal.ts
Outdated
| */ | ||
|
|
||
| private parseLabelLocation(line: string): LocationInfo | undefined { | ||
| const rxLocation = /\s*(?:at )?line (\d+), column (\d+)(?: of macro called at line (\d+), column (\d+))?.?\s*/g; // no closing `$` |
Contributor
Author
There was a problem hiding this comment.
I don't think removing the $ is actually necessary here; if everything else in the PR looks okay I can test and possibly remove this comment.
Contributor
Author
|
Also, I checked procedure label insertion just to be sure. They work fine. |
Signed-off-by: Hillel <h@hillelwayne.com>
Contributor
Author
|
Comment moved, ready to merge! |
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.
Fixes #352
Since parsing rules for label insertions due to macros are slightly different than parsing any other location in the translation output, I figured it would work best to add a separate
parseLabelLocationmethod with different rules. See docstring for an explanation as to differences.