Skip to content

Commit 9fc31d4

Browse files
author
wonder
committed
Fixed operator precedence (#2308)
git-svn-id: http://svn.osgeo.org/qgis/trunk@12578 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 5f4256a commit 9fc31d4

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/core/qgssearchstringparser.yy

+11-8
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,21 @@ void addToTmpNodes(QgsSearchTreeNode* node);
8484
//%error-verbose
8585

8686
// operator precedence
87-
// all operators have left associativity
88-
// (right associtativity is used for assignment)
89-
%left '^'
90-
%left '*' '/'
91-
%left '+' '-'
92-
%left UMINUS // fictious symbol (for unary minus)
93-
%left COMPARISON
87+
// all operators have left associativity, i.e. 1+2+3 traslates to (1+2)+3
88+
// the order of operators here determines their precendence
9489

95-
%left AND
9690
%left OR
91+
%left AND
9792
%left NOT
9893

94+
%left COMPARISON
95+
96+
%left '+' '-'
97+
%left '*' '/'
98+
%left '^'
99+
%left UMINUS // fictious symbol (for unary minus)
100+
101+
99102
%%
100103

101104
root: search_cond { /*gParserRootNode = $1;*/ }

0 commit comments

Comments
 (0)