-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
good first issueOpportunity for newcomers to contribute to php-cypher-dslOpportunity for newcomers to contribute to php-cypher-dslsubject/query-readabilityIssues related to the readability of generated queriesIssues related to the readability of generated queriestype/enhancementNew feature or requestNew feature or request
Milestone
Description
Currently, parentheses are always inserted when creating an expression (unless $insertParentheses
is false
). This leads to less readable expressions: compare ((a AND b) OR (c AND d))
to a AND b OR c AND d
.
I propose to only insert parentheses when this is required by precedence rules. There is no explicit document on the precedence of operators in Cypher AFAIK, but it can be derived from the grammar:
IN
,STARTS WITH
,ENDS WITH
,CONTAINS
,=~
,IS NULL
,IS NOT NULL
+
,-
(unary)^
*
,/
,%
+
,-
(binary)=
,<>
,<
,>
,<=
,>=
NOT
AND
XOR
OR
transistivetransistive
Metadata
Metadata
Assignees
Labels
good first issueOpportunity for newcomers to contribute to php-cypher-dslOpportunity for newcomers to contribute to php-cypher-dslsubject/query-readabilityIssues related to the readability of generated queriesIssues related to the readability of generated queriestype/enhancementNew feature or requestNew feature or request