Skip to content

Commit ae36dd6

Browse files
committed
Fixed operator precedence
Fixes: #89
1 parent a1ed873 commit ae36dd6

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
8+
### Fixed
9+
- Fixed operator precedence
10+
[#89](https://github.com/phalcon/php-zephir-parser/issues/89)
11+
812
## [1.3.3] - 2019-12-10
913
### Added
1014
- Added PHP 7.4 support

parser/zephir.lemon

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
%name xx_
3232

3333
// Define operator precedence early so that this is the first occurrence
34-
// of the operator tokens in the grammer. Keeping the operators together
34+
// of the operator tokens in the grammar. Keeping the operators together
3535
// causes them to be assigned integer values that are close together,
3636
// which keeps parser tables smaller.
3737
//
@@ -46,8 +46,12 @@
4646
%left OR .
4747
%left AND .
4848
%left INSTANCEOF .
49-
%left BITWISE_OR BITWISE_XOR BITWISE_SHIFTLEFT BITWISE_SHIFTRIGHT .
50-
%left EQUALS IDENTICAL LESS GREATER LESSEQUAL GREATEREQUAL NOTIDENTICAL NOTEQUALS .
49+
%left BITWISE_OR .
50+
%left BITWISE_XOR .
51+
%left BITWISE_AND .
52+
%left EQUALS IDENTICAL NOTIDENTICAL NOTEQUALS .
53+
%left LESS GREATER LESSEQUAL GREATEREQUAL .
54+
%left BITWISE_SHIFTLEFT BITWISE_SHIFTRIGHT .
5155
%left ADD SUB CONCAT .
5256
%left MUL DIV MOD .
5357
%right ISSET FETCH EMPTY .
@@ -57,7 +61,6 @@
5761
%right NEW .
5862
%right NOT .
5963
%right BITWISE_NOT .
60-
%left BITWISE_AND .
6164
%right PARENTHESES_CLOSE .
6265
%right SBRACKET_OPEN .
6366
%right ARROW .

0 commit comments

Comments
 (0)