diff options
Diffstat (limited to 'ext/tokenizer/tokenizer.c')
-rw-r--r-- | ext/tokenizer/tokenizer.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c index 6d671f47e3..91ace6f701 100644 --- a/ext/tokenizer/tokenizer.c +++ b/ext/tokenizer/tokenizer.c @@ -127,8 +127,8 @@ static zend_bool tokenize(zval *return_value, zend_string *source) zval source_zval; zend_lex_state original_lex_state; zval token; - zend_ast_loc loc; int token_type; + int token_line = 1; int need_tokens = -1; /* for __halt_compiler lexing. -1 = disabled */ ZVAL_STR_COPY(&source_zval, source); @@ -142,8 +142,8 @@ static zend_bool tokenize(zval *return_value, zend_string *source) LANG_SCNG(yy_state) = yycINITIAL; array_init(return_value); - while ((token_type = lex_scan(&token, NULL, &loc))) { - add_token(return_value, token_type, zendtext, zendleng, loc.start_line); + while ((token_type = lex_scan(&token, NULL))) { + add_token(return_value, token_type, zendtext, zendleng, token_line); if (Z_TYPE(token) != IS_UNDEF) { zval_ptr_dtor_nogc(&token); @@ -159,13 +159,20 @@ static zend_bool tokenize(zval *return_value, zend_string *source) /* fetch the rest into a T_INLINE_HTML */ if (zendcursor != zendlimit) { add_token(return_value, T_INLINE_HTML, - zendcursor, zendlimit - zendcursor, loc.start_line); + zendcursor, zendlimit - zendcursor, token_line); } break; } } else if (token_type == T_HALT_COMPILER) { need_tokens = 3; } + + if (CG(increment_lineno)) { + CG(zend_lineno)++; + CG(increment_lineno) = 0; + } + + token_line = CG(zend_lineno); } zval_ptr_dtor_str(&source_zval); |