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

tests to verify parsers ignore whitespace and comments #430

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

hudlow
Copy link
Contributor

@hudlow hudlow commented Dec 24, 2024

No description provided.

Comment on lines 176 to 181
test {
name: "carriage_return_terminated"
description: "Check that carriage-return-terminated comments are ignored."
expr: "[// @\r.// @\rcel.// @\rexpr// @\r.conformance.// @\rproto3.// @\rTestAllTypes// @\r{// @\rsingle_int64// @\r:// @\rint// @\r(// @\r17// @\r)// @\r}// @\r.// @\rsingle_int64// @\r]// @\r[// @\r0// @\r]// @\r==// @\r(// @\r18// @\r-// @\r1// @\r)// @\r&&// @\r!// @\rfalse// @\r?// @\r1// @\r:// @\r2"
value { int64_value: 1 }
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

cel-go currently fails this, but it is legal per the grammar. I did not check other implementations.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the antlr grammars are specifically looking for LF '\n' to terminate the comment so this will fail for the implementations we maintain (Java/C++/Go). I'm not sure if we should update the cel-spec description of the grammar or the implementations for this case. I'll defer to @TristonianJones

Copy link
Collaborator

Choose a reason for hiding this comment

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

At the moment, it's probably best to update the grammar in cel-spec and revisit whether adding \r termination is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the grammar.

@jnthntatum
Copy link
Collaborator

/gcbrun

Verified

This commit was signed with the committer’s verified signature.
hudlow Dan Hudlow
@hudlow hudlow force-pushed the whitespace-comment-testing branch from 76b15cc to 4998d59 Compare January 10, 2025 17:39
@TristonianJones
Copy link
Collaborator

/gcbrun

@TristonianJones
Copy link
Collaborator

Thanks for the contribution!

@TristonianJones TristonianJones merged commit 8fdb299 into google:master Jan 13, 2025
2 checks passed
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.

None yet

3 participants