-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add diagnostic for pluscal labels inserted by translation #350
Conversation
Signed-off-by: Hillel <h@hillelwayne.com>
f71c5f3
to
9882674
Compare
src/parsers/pluscal.ts
Outdated
return false | ||
} | ||
|
||
const matcher = /^\s\s([A-Za-z0-9_]+) at line (\d+), column (\d+)$/g.exec(line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this robust against any valid "label root" that a user may pass with -labelRoot
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not. I translating with -reportLabels -labelRoot "foo!ASD bar"
and it successfully translated. No diagnostic appeared.
I'd argue this is a bug in the pluscal translator, though: it produces the operator
foo!ASD bar1 ==
Which isn't valid TLA+ in the first place. The regex does accept any valid TLA+ identifier (SS 227).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please open a Pcal issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took some time but that's now done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Hillel <h@hillelwayne.com>
Signed-off-by: Hillel <h@hillelwayne.com>
Signed-off-by: Hillel <h@hillelwayne.com>
The PlusCal translator has a
-reportLabels
flag. When set, it will automatically add missing labels to translations and log that in the output:Since it's logged, we might as well tell the user about it! This PR adds an information diagnostic. Demo:
Questions:
warning
instead ofinformation
?