Description
The dataCategoryName rule in antlr/BaseApexParser.g4 reads:
dataCategoryName
: soqlId
| LPAREN soqlId (COMMA soqlId)* LPAREN;
The second alternative opens the list with LPAREN but also closes it with LPAREN instead of RPAREN. As a result, valid multi-category WITH DATA CATEGORY filters fail to parse, while the never-valid form (usa__c, uk__c( would be accepted.
Reproduction
This query is taken verbatim from the Salesforce WITH DATA CATEGORY documentation:
SELECT Title FROM Question WHERE LastReplyDate > 2005-10-08T01:02:03Z WITH DATA CATEGORY Geography__c AT (usa__c, uk__c)
Parsing it with parser.query() (verified against v5.1.0, both npm and jvm targets) produces one syntax error at the closing ). Single-category filters (... AT usa__c) use the first alternative and are unaffected — likely why this has gone unnoticed.
Fix
One token: change the trailing LPAREN to RPAREN. I have the fix plus regression tests (the three doc examples, mirrored in both npm and jvm test suites) ready and will open a PR referencing this issue.
Description
The
dataCategoryNamerule inantlr/BaseApexParser.g4reads:The second alternative opens the list with
LPARENbut also closes it withLPARENinstead ofRPAREN. As a result, valid multi-categoryWITH DATA CATEGORYfilters fail to parse, while the never-valid form(usa__c, uk__c(would be accepted.Reproduction
This query is taken verbatim from the Salesforce WITH DATA CATEGORY documentation:
Parsing it with
parser.query()(verified against v5.1.0, both npm and jvm targets) produces one syntax error at the closing). Single-category filters (... AT usa__c) use the first alternative and are unaffected — likely why this has gone unnoticed.Fix
One token: change the trailing
LPARENtoRPAREN. I have the fix plus regression tests (the three doc examples, mirrored in both npm and jvm test suites) ready and will open a PR referencing this issue.