Skip to content

Problem parsing oC_MultiPartQuery with ANTLR4 #508

@dahoat

Description

@dahoat

Hi to all,

I am using the ANTLR4 grammar in version M16 (https://s3.amazonaws.com/artifacts.opencypher.org/M16/Cypher.g4) and have an issue with oC_MultiPartQuery:

In the grammar, it says:

oC_MultiPartQuery
              :  ( ( oC_ReadingClause SP? )* ( oC_UpdatingClause SP? )* oC_With SP? )+ oC_SinglePartQuery ;

To my understanding, it is therefore possible to write something like this

MATCH (c:Label), (d:Label2) SET c.property = d.property WITH c MATCH (e:Label3 {name: c.name}) RETURN c

However, in the ANTLR4 parser (Java), i only get List<oC_ReadingClause>, List<oC_UpdatingClause> and List<oC_With>. Therefore, I cannot distinguish whether (e:Label3 {name: c.name}) belongs before which entry in List<oC_With> or after any entry.

Therfore, I propose changing the grammar to something like

oC_MultiPartQuery
              :  ( oC_MultiPartQueryGroup )+ oC_SinglePartQuery ;

oC_MultiPartQueryGroup
              :  ( oC_ReadingClause SP? )* ( oC_UpdatingClause SP? )* oC_With SP? ;

I am no expert in grammars so please excuse me if I missed something here.

All the best,
Daniel

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions