File tree Expand file tree Collapse file tree 3 files changed +119
-2
lines changed Expand file tree Collapse file tree 3 files changed +119
-2
lines changed Original file line number Diff line number Diff line change @@ -560,8 +560,8 @@ int xx_get_token(xx_scanner_state *s, xx_scanner_token *token) {
560560 CBLOCK = (" %{" ([^}]+|[}]+[^%{])*" }%" );
561561 CBLOCK {
562562 token->opcode = XX_T_CBLOCK;
563- token->value = estrndup (start+ 1 , YYCURSOR - start - 3 );
564- token->len = YYCURSOR - start - 3 ;
563+ token->value = estrndup (start + 1 , YYCURSOR - start - 2 );
564+ token->len = YYCURSOR - start - 2 ;
565565 {
566566 int k, ch = s->active_char ;
567567 for (k = 0 ; k < (token->len - 1 ); k++) {
Original file line number Diff line number Diff line change 1+ --TEST--
2+ cblocks - Tests recognizing wrapping C-code in CBLOCKs
3+ --SKIPIF--
4+ <?php if (!extension_loaded ("Zephir Parser " )) print "skip The zephir_parser extension is not loaded " ; ?>
5+ --FILE--
6+ <?php require (__DIR__ . "/../zephir_parser_test.inc " );
7+
8+ $ ir = parse_file ("base/cblocks.zep " );
9+ var_dump ($ ir );
10+ --EXPECTF --
11+ array (2 ) {
12+ [0 ]=>
13+ array (5 ) {
14+ ["type " ]=>
15+ string(9 ) "namespace "
16+ ["name " ]=>
17+ string(7 ) "Example "
18+ ["file " ]=>
19+ string(%d) "%s/tests/data/base/cblocks.zep "
20+ ["line " ]=>
21+ int(3 )
22+ ["char " ]=>
23+ int(5 )
24+ }
25+ [1 ]=>
26+ array (8 ) {
27+ ["type " ]=>
28+ string(5 ) "class "
29+ ["name " ]=>
30+ string(4 ) "Test "
31+ ["abstract " ]=>
32+ int(0 )
33+ ["final " ]=>
34+ int(0 )
35+ ["definition " ]=>
36+ array (4 ) {
37+ ["methods " ]=>
38+ array (1 ) {
39+ [0 ]=>
40+ array (8 ) {
41+ ["visibility " ]=>
42+ array (1 ) {
43+ [0 ]=>
44+ string(6 ) "public "
45+ }
46+ ["type " ]=>
47+ string(6 ) "method "
48+ ["name " ]=>
49+ string(5 ) "block "
50+ ["statements " ]=>
51+ array (1 ) {
52+ [0 ]=>
53+ array (5 ) {
54+ ["type " ]=>
55+ string(6 ) "cblock "
56+ ["value " ]=>
57+ string(83 ) "{
58+
59+ // Some comment
60+
61+ {
62+ while(1) {
63+ RETURN_MM_NULL();
64+ }
65+ }
66+ } "
67+ ["file " ]=>
68+ string(%d) "%s/tests/data/base/cblocks.zep "
69+ ["line " ]=>
70+ int(17 )
71+ ["char " ]=>
72+ int(2 )
73+ }
74+ }
75+ ["file " ]=>
76+ string(%d) "%s/tests/data/base/cblocks.zep "
77+ ["line " ]=>
78+ int(5 )
79+ ["last-line " ]=>
80+ int(18 )
81+ ["char " ]=>
82+ int(16 )
83+ }
84+ }
85+ ["file " ]=>
86+ string(%d) "%s/tests/data/base/cblocks.zep "
87+ ["line " ]=>
88+ int(3 )
89+ ["char " ]=>
90+ int(5 )
91+ }
92+ ["file " ]=>
93+ string(%d) "%s/tests/data/base/cblocks.zep "
94+ ["line " ]=>
95+ int(3 )
96+ ["char " ]=>
97+ int(5 )
98+ }
99+ }
Original file line number Diff line number Diff line change 1+ namespace Example;
2+
3+ class Test
4+ {
5+ public function block ()
6+ {
7+ % {
8+
9+ // Some comment
10+
11+ {
12+ while (1 ) {
13+ RETURN_MM_NULL ();
14+ }
15+ }
16+ }%
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments