-
Notifications
You must be signed in to change notification settings - Fork 124
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
Invalid CQL Parsing when missing comma in List construction #1254
Comments
I can confirm that it seems that the translator needs a correct syntax for the list definition. If I try with the given examples I get a set of errors related to the incorrect lists. If I remove or correct them it goes through without triggering those errors, just a few related to TreatmentConcept_X. With wrong syntax for lists: Nothing when removed. |
It would be helpful if we could see the ANTLR parse tree from the script, but I don't know how to do that (would be nice if the CQL dev guide put out some instructions on using ANTLR tools to help debug scripts). My intuition is that the 2 definition identifiers right next to each other is counting as a singular 'expression' from parsing, because only the first definitions of the results in the "bad concatenated set" was captured and rendered when the script ran. Here's the list specification from the ANTLR rules.
Clearly; the only thing that 2 quote strings with whitespace between them could be seen as is an 'expression' right? |
I was mistaken on Zulip. I took a look at this and it is indeed valid CQL. The second identifier is treated as an alias, as if you were querying a list. This is a result of automatic List Promotion
There's some work here to add warnings for hidden identifiers which will help identify this issue: I'll prioritize reviewing that and getting it in. |
Why are quoted identifiers allowed for aliases? No examples in the cookbook, the author's guide, or the developer's guide use quoted identifiers. This feels to me like a feature of the grammar that's overly permissive. Especially in List/Tuple declaration, it's would mostly pretty niche to want to define items with aliases within a List or Tuple. And such definitions would be difficult to parse/unintuitive scripting. |
Any identifier is allowed as an alias for the same reason quoted identifiers are allowed in general, which is that it gives an author a way to assign a “natural language” meaning, including spaces and so on. Deeply nested/chained queries could have aliases like “Patient Encounter With Correlated Cancer Diagnosis”. That said, I agree that’s it’s confusing in this case. :) |
I believe this only happens with List types getting concatenated together in the expression. See this example below, it only seems to happen with List types. Issue is with "ListTest6"
The text was updated successfully, but these errors were encountered: