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 88 - ' *.md'
99 pull_request :
1010 branches :
11- - ' master'
12- - ' development'
11+ - master
12+ - development
1313 schedule :
1414 - cron : ' 0 11 * * *'
1515
2121 matrix :
2222 re2c :
2323 - ' 0.13.6'
24- - ' 1.2.1 '
24+ - ' 1.3 '
2525 php :
2626 - ' 7.0'
2727 - ' 7.1'
@@ -48,12 +48,12 @@ jobs:
4848 USE_ZEND_ALLOC : 0
4949
5050 steps :
51- - uses : actions/checkout@v2-beta
51+ - uses : actions/checkout@v2
5252 with :
5353 fetch-depth : 5
5454
5555 - name : Install PHP ${{ matrix.php }}
56- uses : shivammathur/setup-php@v1
56+ uses : shivammathur/setup-php@v2
5757 with :
5858 php-version : ' ${{ matrix.php }}'
5959 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/)
55and 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
Original file line number Diff line number Diff line change 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//
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 .
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 .
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