File tree Expand file tree Collapse file tree 4 files changed +141
-9
lines changed Expand file tree Collapse file tree 4 files changed +141
-9
lines changed Original file line number Diff line number Diff line change 8
8
- ' *.md'
9
9
pull_request :
10
10
branches :
11
- - ' master'
12
- - ' development'
11
+ - master
12
+ - development
13
13
schedule :
14
14
- cron : ' 0 11 * * *'
15
15
21
21
matrix :
22
22
re2c :
23
23
- ' 0.13.6'
24
- - ' 1.2.1 '
24
+ - ' 1.3 '
25
25
php :
26
26
- ' 7.0'
27
27
- ' 7.1'
@@ -48,12 +48,12 @@ jobs:
48
48
USE_ZEND_ALLOC : 0
49
49
50
50
steps :
51
- - uses : actions/checkout@v2-beta
51
+ - uses : actions/checkout@v2
52
52
with :
53
53
fetch-depth : 5
54
54
55
55
- name : Install PHP ${{ matrix.php }}
56
- uses : shivammathur/setup-php@v1
56
+ uses : shivammathur/setup-php@v2
57
57
with :
58
58
php-version : ' ${{ matrix.php }}'
59
59
coverage : none
Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
6
6
7
7
## [ Unreleased]
8
+ ### Fixed
9
+ - Fixed operator precedence
10
+ [ #89 ] ( https://github.com/phalcon/php-zephir-parser/issues/89 )
11
+
8
12
## [ 1.3.3] - 2019-12-10
9
13
### Added
10
14
- Added PHP 7.4 support
Original file line number Diff line number Diff line change 31
31
%name xx_
32
32
33
33
// 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
35
35
// causes them to be assigned integer values that are close together,
36
36
// which keeps parser tables smaller.
37
37
//
46
46
%left OR .
47
47
%left AND .
48
48
%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 .
51
55
%left ADD SUB CONCAT .
52
56
%left MUL DIV MOD .
53
57
%right ISSET FETCH EMPTY .
57
61
%right NEW .
58
62
%right NOT .
59
63
%right BITWISE_NOT .
60
- %left BITWISE_AND .
61
64
%right PARENTHESES_CLOSE .
62
65
%right SBRACKET_OPEN .
63
66
%right ARROW .
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Tests bitwise operators priority
3
+ --SKIPIF--
4
+ <?php include (__DIR__ . '/../skipif.inc ' ); ?>
5
+ --FILE--
6
+ <?php
7
+
8
+ $ code =<<<ZEP
9
+ function test () {
10
+ let t = u & v << 7;
11
+ }
12
+ ZEP ;
13
+
14
+ var_dump (zephir_parse_file ($ code , '(eval code) ' ));
15
+
16
+ ?>
17
+ --EXPECT--
18
+ array(1) {
19
+ [0]=>
20
+ array(6) {
21
+ ["type"]=>
22
+ string(8) "function"
23
+ ["name"]=>
24
+ string(4) "test"
25
+ ["statements"]=>
26
+ array(1) {
27
+ [0]=>
28
+ array(5) {
29
+ ["type"]=>
30
+ string(3) "let"
31
+ ["assignments"]=>
32
+ array(1) {
33
+ [0]=>
34
+ array(7) {
35
+ ["assign-type"]=>
36
+ string(8) "variable"
37
+ ["operator"]=>
38
+ string(6) "assign"
39
+ ["variable"]=>
40
+ string(1) "t"
41
+ ["expr"]=>
42
+ array(6) {
43
+ ["type"]=>
44
+ string(11) "bitwise_and"
45
+ ["left"]=>
46
+ array(5) {
47
+ ["type"]=>
48
+ string(8) "variable"
49
+ ["value"]=>
50
+ string(1) "u"
51
+ ["file"]=>
52
+ string(11) "(eval code)"
53
+ ["line"]=>
54
+ int(2)
55
+ ["char"]=>
56
+ int(15)
57
+ }
58
+ ["right"]=>
59
+ array(6) {
60
+ ["type"]=>
61
+ string(17) "bitwise_shiftleft"
62
+ ["left"]=>
63
+ array(5) {
64
+ ["type"]=>
65
+ string(8) "variable"
66
+ ["value"]=>
67
+ string(1) "v"
68
+ ["file"]=>
69
+ string(11) "(eval code)"
70
+ ["line"]=>
71
+ int(2)
72
+ ["char"]=>
73
+ int(20)
74
+ }
75
+ ["right"]=>
76
+ array(5) {
77
+ ["type"]=>
78
+ string(3) "int"
79
+ ["value"]=>
80
+ string(1) "7"
81
+ ["file"]=>
82
+ string(11) "(eval code)"
83
+ ["line"]=>
84
+ int(2)
85
+ ["char"]=>
86
+ int(23)
87
+ }
88
+ ["file"]=>
89
+ string(11) "(eval code)"
90
+ ["line"]=>
91
+ int(2)
92
+ ["char"]=>
93
+ int(23)
94
+ }
95
+ ["file"]=>
96
+ string(11) "(eval code)"
97
+ ["line"]=>
98
+ int(2)
99
+ ["char"]=>
100
+ int(23)
101
+ }
102
+ ["file"]=>
103
+ string(11) "(eval code)"
104
+ ["line"]=>
105
+ int(2)
106
+ ["char"]=>
107
+ int(23)
108
+ }
109
+ }
110
+ ["file"]=>
111
+ string(11) "(eval code)"
112
+ ["line"]=>
113
+ int(3)
114
+ ["char"]=>
115
+ int(1)
116
+ }
117
+ }
118
+ ["file"]=>
119
+ string(11) "(eval code)"
120
+ ["line"]=>
121
+ int(1)
122
+ ["char"]=>
123
+ int(9)
124
+ }
125
+ }
You can’t perform that action at this time.
0 commit comments