-
Notifications
You must be signed in to change notification settings - Fork 85
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
CQL2/Grammar: Quoted identifiers not defined as expected #916
Comments
Meeting 2024-04-08: The original issue was #332 which included the following statement:
The PR that closed this issue (in 2020) resolved the "avoid clashes" aspect, but not the "deal with special characters in an identifier" part. The text in #332 is not entirely clear if this was intended or not. Since this change is also in the BNF for years it is unclear, if we could change this now as the document is now under TC control. @pvretano, any thoughts? |
@cportele Thinking about this more, the current rule does not even serve the purpose of avoiding clashes with reserved CQL2 keywords. So there definitely is a problem to fix anyways. Either:
Although perhaps in ANTLR4 the ambiguities somehow get resolved with the order of the rules as you have them in: At minimum I think that |
@jerstlouis - I don't think there is a problem in our grammar (or the BNF) wrt to avoiding clashes. We test all the different cases in unit tests and the results are as expected. If the parser reads |
@cportele right, sorry, I just tried that with your lexer and parser on http://lab.antlr.org/ . Thanks for double-checking. I'm still confused as to why there's no error or ambiguity given that In the BNF grammar as a single piece though (not separated as lexer + parser), I think it might still be ambiguous. (I just tested that and indeed the double-quoting of |
Meeting 2024-04-22: The current rule is what it is since December 2020 and it did not raise any issues in implementations. Given that the document is under TC control now (in the approval vote) and this is not a bug, we cannot make the change now. It would either require a TC vote with a comment or it is future work. |
Since no issue was raised in the approval process, I move this issue to "future work" (see the previous comment). |
My understanding is we should be able to put just about anything in quoted identifiers (
" "
).Currently, the
propertyName
rule which is the closest thing that corresponds to an identifier token uses the exact sameidentifier
inside and outside the quotes:I seem to recall us discussing this before, but don't recall the decision.
In the currently state, this completely defeats the purpose of the quoted identifiers however.
A use case in our CartoSym-CSS styles is a selector on the
"sentinel2-l2a"
layer which contains a hyphen.See how we defined this in the CartoSym-CSS BNF for ANTLR:
https://github.com/opengeospatial/styles-and-symbology/blob/main/1-core/schemas/CartoSym-CSS-Lexer.g4#L110
allowing inside the double quotes all the same characters as inside a string literal with the exception of the double quote.
The only thing that this might currently be missing the the capability to backslash escape the double quote
\"
or to otherwise allow to use single quotes directly).The text was updated successfully, but these errors were encountered: