diff options
| author | Dmitry Stogov <dmitry@php.net> | 2007-05-18 13:12:47 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2007-05-18 13:12:47 +0000 |
| commit | 5dc51fecf8403d9f34d852c904f42e42d53a594f (patch) | |
| tree | 296341956df8d9c36f5a2b2ab38daf953b198d9f /ext/tokenizer | |
| parent | c7496d3db8c16a891e3ea260e5e5ad6c056e4750 (diff) | |
| download | php-git-5dc51fecf8403d9f34d852c904f42e42d53a594f.tar.gz | |
Improved compilation of heredocs and interpolated strings. (Matt)
Diffstat (limited to 'ext/tokenizer')
| -rw-r--r-- | ext/tokenizer/tests/001.phpt | 6 | ||||
| -rw-r--r-- | ext/tokenizer/tests/bug26463.phpt | 58 | ||||
| -rw-r--r-- | ext/tokenizer/tokenizer.c | 11 |
3 files changed, 37 insertions, 38 deletions
diff --git a/ext/tokenizer/tests/001.phpt b/ext/tokenizer/tests/001.phpt index a8ab6bd523..7bac6b96e5 100644 --- a/ext/tokenizer/tests/001.phpt +++ b/ext/tokenizer/tests/001.phpt @@ -57,8 +57,6 @@ echo token_name(T_STRING_VARNAME), "\n"; echo token_name(T_VARIABLE), "\n"; echo token_name(T_NUM_STRING), "\n"; echo token_name(T_INLINE_HTML), "\n"; -echo token_name(T_CHARACTER), "\n"; -echo token_name(T_BAD_CHARACTER), "\n"; echo token_name(T_ENCAPSED_AND_WHITESPACE), "\n"; echo token_name(T_CONSTANT_ENCAPSED_STRING), "\n"; echo token_name(T_ECHO), "\n"; @@ -185,8 +183,6 @@ T_STRING_VARNAME T_VARIABLE T_NUM_STRING T_INLINE_HTML -T_CHARACTER -T_BAD_CHARACTER T_ENCAPSED_AND_WHITESPACE T_CONSTANT_ENCAPSED_STRING T_ECHO @@ -314,8 +310,6 @@ T_STRING_VARNAME T_VARIABLE T_NUM_STRING T_INLINE_HTML -T_CHARACTER -T_BAD_CHARACTER T_ENCAPSED_AND_WHITESPACE T_CONSTANT_ENCAPSED_STRING T_ECHO diff --git a/ext/tokenizer/tests/bug26463.phpt b/ext/tokenizer/tests/bug26463.phpt index c72d478403..de32769617 100644 --- a/ext/tokenizer/tests/bug26463.phpt +++ b/ext/tokenizer/tests/bug26463.phpt @@ -15,12 +15,12 @@ DDDD; ?>'; var_dump(token_get_all($str)); ?> ---EXPECT-- +--EXPECTF-- array(19) { [0]=> array(3) { [0]=> - int(370) + int(%d) [1]=> string(6) "<?php " @@ -30,7 +30,7 @@ array(19) { [1]=> array(3) { [0]=> - int(311) + int(%d) [1]=> string(2) "$x" [2]=> @@ -41,7 +41,7 @@ array(19) { [3]=> array(3) { [0]=> - int(374) + int(%d) [1]=> string(6) "<<<DD " @@ -51,7 +51,7 @@ array(19) { [4]=> array(3) { [0]=> - int(309) + int(%d) [1]=> string(13) "jhdsjkfhjdsh " @@ -61,7 +61,7 @@ array(19) { [5]=> array(3) { [0]=> - int(375) + int(%d) [1]=> string(2) "DD" [2]=> @@ -70,7 +70,7 @@ array(19) { [6]=> array(3) { [0]=> - int(373) + int(%d) [1]=> string(1) " " @@ -82,7 +82,7 @@ array(19) { [8]=> array(3) { [0]=> - int(317) + int(%d) [1]=> string(2) """" [2]=> @@ -93,7 +93,7 @@ array(19) { [10]=> array(3) { [0]=> - int(373) + int(%d) [1]=> string(1) " " @@ -103,7 +103,7 @@ array(19) { [11]=> array(3) { [0]=> - int(311) + int(%d) [1]=> string(2) "$a" [2]=> @@ -114,7 +114,7 @@ array(19) { [13]=> array(3) { [0]=> - int(374) + int(%d) [1]=> string(8) "<<<DDDD " @@ -124,7 +124,7 @@ array(19) { [14]=> array(3) { [0]=> - int(309) + int(%d) [1]=> string(13) "jhdsjkfhjdsh " @@ -134,7 +134,7 @@ array(19) { [15]=> array(3) { [0]=> - int(375) + int(%d) [1]=> string(4) "DDDD" [2]=> @@ -145,7 +145,7 @@ array(19) { [17]=> array(3) { [0]=> - int(373) + int(%d) [1]=> string(1) " " @@ -155,7 +155,7 @@ array(19) { [18]=> array(3) { [0]=> - int(372) + int(%d) [1]=> string(2) "?>" [2]=> @@ -167,7 +167,7 @@ array(19) { [0]=> array(3) { [0]=> - int(370) + int(%d) [1]=> string(6) "<?php " @@ -177,7 +177,7 @@ array(19) { [1]=> array(3) { [0]=> - int(311) + int(%d) [1]=> string(2) "$x" [2]=> @@ -188,7 +188,7 @@ array(19) { [3]=> array(3) { [0]=> - int(374) + int(%d) [1]=> string(6) "<<<DD " @@ -198,7 +198,7 @@ array(19) { [4]=> array(3) { [0]=> - int(309) + int(%d) [1]=> string(13) "jhdsjkfhjdsh " @@ -208,7 +208,7 @@ array(19) { [5]=> array(3) { [0]=> - int(375) + int(%d) [1]=> string(2) "DD" [2]=> @@ -217,7 +217,7 @@ array(19) { [6]=> array(3) { [0]=> - int(373) + int(%d) [1]=> string(1) " " @@ -229,7 +229,7 @@ array(19) { [8]=> array(3) { [0]=> - int(317) + int(%d) [1]=> string(2) """" [2]=> @@ -240,7 +240,7 @@ array(19) { [10]=> array(3) { [0]=> - int(373) + int(%d) [1]=> string(1) " " @@ -250,7 +250,7 @@ array(19) { [11]=> array(3) { [0]=> - int(311) + int(%d) [1]=> string(2) "$a" [2]=> @@ -261,7 +261,7 @@ array(19) { [13]=> array(3) { [0]=> - int(374) + int(%d) [1]=> string(8) "<<<DDDD " @@ -271,7 +271,7 @@ array(19) { [14]=> array(3) { [0]=> - int(309) + int(%d) [1]=> string(13) "jhdsjkfhjdsh " @@ -281,7 +281,7 @@ array(19) { [15]=> array(3) { [0]=> - int(375) + int(%d) [1]=> string(4) "DDDD" [2]=> @@ -292,7 +292,7 @@ array(19) { [17]=> array(3) { [0]=> - int(373) + int(%d) [1]=> string(1) " " @@ -302,7 +302,7 @@ array(19) { [18]=> array(3) { [0]=> - int(372) + int(%d) [1]=> string(2) "?>" [2]=> diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c index 3727ec0a49..bd60a970fe 100644 --- a/ext/tokenizer/tokenizer.c +++ b/ext/tokenizer/tokenizer.c @@ -282,12 +282,15 @@ static void tokenize(zval *return_value TSRMLS_DC) while ((token_type = lex_scan(&token TSRMLS_CC))) { destroy = 1; switch (token_type) { + case T_CLOSE_TAG: + if (zendtext[zendleng - 1] != '>') { + CG(zend_lineno)++; + } case T_OPEN_TAG: case T_OPEN_TAG_WITH_ECHO: case T_WHITESPACE: case T_COMMENT: case T_DOC_COMMENT: - case T_CLOSE_TAG: destroy = 0; break; } @@ -297,6 +300,10 @@ static void tokenize(zval *return_value TSRMLS_DC) 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, Z_STRVAL(token), Z_STRLEN(token), 1); efree(Z_STRVAL(token)); } else { @@ -372,8 +379,6 @@ get_token_type_name(int token_type) case T_VARIABLE: return "T_VARIABLE"; case T_NUM_STRING: return "T_NUM_STRING"; case T_INLINE_HTML: return "T_INLINE_HTML"; - case T_CHARACTER: return "T_CHARACTER"; - case T_BAD_CHARACTER: return "T_BAD_CHARACTER"; case T_ENCAPSED_AND_WHITESPACE: return "T_ENCAPSED_AND_WHITESPACE"; case T_CONSTANT_ENCAPSED_STRING: return "T_CONSTANT_ENCAPSED_STRING"; case T_ECHO: return "T_ECHO"; |
