Skip to content

Commit 1139d12

Browse files
committed
Fixed wrapping C-code in CBLOCKs (2)
1 parent 1e68ae2 commit 1139d12

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

parser/scanner.re

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,10 @@ int xx_get_token(xx_scanner_state *s, xx_scanner_token *token) {
559559

560560
CBLOCK = ("%{"([^}]+|[}]+[^%{])*"}%");
561561
CBLOCK {
562+
start++;
563+
start++;
562564
token->opcode = XX_T_CBLOCK;
563-
token->value = estrndup(start + 1, YYCURSOR - start - 2);
565+
token->value = estrndup(start, YYCURSOR - start - 2);
564566
token->len = YYCURSOR - start - 2;
565567
{
566568
int k, ch = s->active_char;

tests/base/cblocks.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ array(2) {
5454
["type"]=>
5555
string(6) "cblock"
5656
["value"]=>
57-
string(83) "{
57+
string(81) "
5858
5959
// Some comment
6060
@@ -63,7 +63,7 @@ array(2) {
6363
RETURN_MM_NULL();
6464
}
6565
}
66-
}"
66+
"
6767
["file"]=>
6868
string(%d) "%s/tests/data/base/cblocks.zep"
6969
["line"]=>

0 commit comments

Comments
 (0)