Skip to content
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

Not all returns in parsers are disallowed #3309

Merged
merged 6 commits into from
May 11, 2022
Merged

Conversation

mihaibudiu
Copy link
Contributor

No description provided.

@mihaibudiu
Copy link
Contributor Author

Fixes #3307
This PR also contains a few small other fixes; each is a separate commit.

Signed-off-by: Mihai Budiu <[email protected]>
Copy link
Contributor

@jnfoster jnfoster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@@ -243,7 +243,7 @@ class BoolLiteral : Literal {
class StringLiteral : Literal {
cstring value;
validate{ if (value.isNull()) BUG("null StringLiteral"); }
toString{ return cstring("\"") + value + "\""; }
toString{ return cstring("\"") + value.escapeJson() + "\""; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a one-off fix or is it needed elsewhere in the .def files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we handle string literals anywhere else.

@mihaibudiu mihaibudiu merged commit 5285887 into p4lang:main May 11, 2022
@mihaibudiu mihaibudiu deleted the issue3307 branch May 11, 2022 19:38
github-sajan pushed a commit to github-sajan/p4c that referenced this pull request May 26, 2022
* toupper cstring method
* utility function to specialize actions
* Escape quotes in string literals
* Returns in parsers are allowed if they are in methods

Signed-off-by: Mihai Budiu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants