summaryrefslogtreecommitdiff
path: root/ext/tokenizer
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2017-03-22 22:26:24 +0100
committerNikita Popov <nikita.ppv@gmail.com>2017-03-22 22:33:05 +0100
commitfec708f518d6880d31bfcf6523ee7b165990b5e1 (patch)
tree68b551aa3e07b46291bf626a229ebb6672cdba80 /ext/tokenizer
parent81b2d983556c7b19d00219fe24b5b4d01dde4e1a (diff)
downloadphp-git-fec708f518d6880d31bfcf6523ee7b165990b5e1.tar.gz
Simplify increment_lineno handling
Diffstat (limited to 'ext/tokenizer')
-rw-r--r--ext/tokenizer/tokenizer.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
index 3746fc4e54..f530c555a9 100644
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.c
@@ -129,19 +129,9 @@ static zend_bool tokenize(zval *return_value, zend_string *source)
ZVAL_UNDEF(&token);
while ((token_type = lex_scan(&token))) {
- if (token_type == T_CLOSE_TAG && zendtext[zendleng - 1] != '>') {
- CG(zend_lineno)++;
- }
-
if (token_type >= 256) {
array_init(&keyword);
add_next_index_long(&keyword, token_type);
- if (token_type == T_END_HEREDOC) {
- if (CG(increment_lineno)) {
- token_line = ++CG(zend_lineno);
- CG(increment_lineno) = 0;
- }
- }
add_next_index_stringl(&keyword, (char *)zendtext, zendleng);
add_next_index_long(&keyword, token_line);
add_next_index_zval(return_value, &keyword);
@@ -174,6 +164,11 @@ static zend_bool tokenize(zval *return_value, zend_string *source)
need_tokens = 3;
}
+ if (CG(increment_lineno)) {
+ CG(zend_lineno)++;
+ CG(increment_lineno) = 0;
+ }
+
token_line = CG(zend_lineno);
}