backport the yyless patch from 5.3 branch. it seems I forgot to commit this..

# you'll probably need re2c 0.13.5 or newer to regenerate this file
# Matt: please advise if there's still somrthing pending (i.e. was the heredoc/nowdoc patch MFB already?
This commit is contained in:
Nuno Lopes 2008-06-06 17:34:43 +00:00
parent ec965d1531
commit 1c5df1565f
3 changed files with 403 additions and 423 deletions

File diff suppressed because it is too large Load Diff

View File

@ -63,7 +63,8 @@
#define YYSTATE YYGETCONDITION() #define YYSTATE YYGETCONDITION()
#define yytext ((char*)SCNG(yy_text)) #define yytext ((char*)SCNG(yy_text))
#define yyleng SCNG(yy_leng) #define yyleng SCNG(yy_leng)
#define yyless(x) YYCURSOR = yytext + x #define yyless(x) do { YYCURSOR = (unsigned char*)yytext + (x); \
yyleng = (unsigned int)(x); } while(0)
#define yymore() goto yymore_restart #define yymore() goto yymore_restart
/* perform sanity check. If this message is triggered you should /* perform sanity check. If this message is triggered you should
@ -2197,8 +2198,7 @@ inline_char_handler:
* and "->" will be taken literally * and "->" will be taken literally
*/ */
<ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE>"$"{LABEL}"->"[a-zA-Z_\x7f-\xff] { <ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE>"$"{LABEL}"->"[a-zA-Z_\x7f-\xff] {
yyleng -= 3; yyless(yyleng - 3);
yyless(yyleng);
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) {
@ -2213,8 +2213,7 @@ inline_char_handler:
/* A [ always designates a variable offset, regardless of what follows /* A [ always designates a variable offset, regardless of what follows
*/ */
<ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE>"$"{LABEL}"[" { <ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE>"$"{LABEL}"[" {
yyleng--; yyless(yyleng - 1);
yyless(yyleng);
yy_push_state(ST_VAR_OFFSET TSRMLS_CC); yy_push_state(ST_VAR_OFFSET TSRMLS_CC);
if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) { if (!zend_copy_scanner_string(zendlval, (yytext+1), (yyleng-1), UG(unicode)?IS_UNICODE:IS_STRING, SCNG(output_conv) TSRMLS_CC)) {
@ -2249,7 +2248,6 @@ inline_char_handler:
<ST_VAR_OFFSET>[ \n\r\t\\'#] { <ST_VAR_OFFSET>[ \n\r\t\\'#] {
/* Invalid rule to return a more explicit parse error with proper line number */ /* Invalid rule to return a more explicit parse error with proper line number */
yyless(0); yyless(0);
yyleng = 0;
yy_pop_state(TSRMLS_C); yy_pop_state(TSRMLS_C);
ZVAL_EMPTY_TEXT(zendlval); /* Empty since it won't be used */ ZVAL_EMPTY_TEXT(zendlval); /* Empty since it won't be used */
return T_ENCAPSED_AND_WHITESPACE; return T_ENCAPSED_AND_WHITESPACE;
@ -2314,8 +2312,7 @@ inline_char_handler:
Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */
Z_STRLEN_P(zendlval) = yyleng-2; Z_STRLEN_P(zendlval) = yyleng-2;
Z_TYPE_P(zendlval) = IS_STRING; Z_TYPE_P(zendlval) = IS_STRING;
yyleng -= 2; yyless(yyleng - 2);
yyless(yyleng);
BEGIN(ST_IN_SCRIPTING); BEGIN(ST_IN_SCRIPTING);
return T_COMMENT; return T_COMMENT;
} else { } else {
@ -2380,7 +2377,6 @@ inline_char_handler:
return T_CLOSE_TAG; /* implicit ';' at php-end tag */ return T_CLOSE_TAG; /* implicit ';' at php-end tag */
} else { } else {
yyless(1); yyless(1);
yyleng = 1;
return yytext[0]; return yytext[0];
} }
} }
@ -2492,7 +2488,6 @@ inline_char_handler:
} }
yyless(label_len); yyless(label_len);
yyleng = label_len;
if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) { if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) {
Z_STRVAL_P(zendlval) = CG(heredoc); Z_STRVAL_P(zendlval) = CG(heredoc);
@ -2589,11 +2584,10 @@ inline_char_handler:
* (("{"+|"$"+)["]) handles { or $ at the end of a string * (("{"+|"$"+)["]) handles { or $ at the end of a string
* *
* Same for backquotes and heredocs, except the second case doesn't apply to * Same for backquotes and heredocs, except the second case doesn't apply to
* heredocs. yyleng--/yyless() is used to correct taking one character too many * heredocs. yyless(yyleng - 1) is used to correct taking one character too many
*/ */
<ST_DOUBLE_QUOTES>{DOUBLE_QUOTES_CHARS}*("{"{2,}|"$"{2,}|(("{"+|"$"+)["])) { <ST_DOUBLE_QUOTES>{DOUBLE_QUOTES_CHARS}*("{"{2,}|"$"{2,}|(("{"+|"$"+)["])) {
yyleng--; yyless(yyleng - 1);
yyless(yyleng);
if (CG(literal_type) == IS_UNICODE) { if (CG(literal_type) == IS_UNICODE) {
return zend_scan_unicode_escape_string(zendlval, yytext, yyleng, 0x22 /*'"'*/, T_ENCAPSED_AND_WHITESPACE TSRMLS_CC); return zend_scan_unicode_escape_string(zendlval, yytext, yyleng, 0x22 /*'"'*/, T_ENCAPSED_AND_WHITESPACE TSRMLS_CC);
@ -2614,8 +2608,7 @@ inline_char_handler:
} }
<ST_BACKQUOTE>{BACKQUOTE_CHARS}*("{"{2,}|"$"{2,}|(("{"+|"$"+)[`])) { <ST_BACKQUOTE>{BACKQUOTE_CHARS}*("{"{2,}|"$"{2,}|(("{"+|"$"+)[`])) {
yyleng--; yyless(yyleng - 1);
yyless(yyleng);
if (CG(literal_type) == IS_UNICODE) { if (CG(literal_type) == IS_UNICODE) {
return zend_scan_unicode_escape_string(zendlval, yytext, yyleng, 0x60 /*'`'*/, T_ENCAPSED_AND_WHITESPACE TSRMLS_CC); return zend_scan_unicode_escape_string(zendlval, yytext, yyleng, 0x60 /*'`'*/, T_ENCAPSED_AND_WHITESPACE TSRMLS_CC);
@ -2643,8 +2636,7 @@ inline_char_handler:
} }
<ST_HEREDOC>{HEREDOC_CHARS}*({HEREDOC_NEWLINE}+({LABEL}";"?)?)?("{"{2,}|"$"{2,}) { <ST_HEREDOC>{HEREDOC_CHARS}*({HEREDOC_NEWLINE}+({LABEL}";"?)?)?("{"{2,}|"$"{2,}) {
yyleng--; yyless(yyleng - 1);
yyless(yyleng);
if (CG(literal_type) == IS_UNICODE) { if (CG(literal_type) == IS_UNICODE) {
return zend_scan_unicode_escape_string(zendlval, yytext, yyleng, 0, T_ENCAPSED_AND_WHITESPACE TSRMLS_CC); return zend_scan_unicode_escape_string(zendlval, yytext, yyleng, 0, T_ENCAPSED_AND_WHITESPACE TSRMLS_CC);

View File

@ -1,4 +1,4 @@
/* Generated by re2c 0.13.4 on Sat Apr 5 19:52:57 2008 */ /* Generated by re2c 0.13.6.dev on Fri Jun 6 18:30:48 2008 */
#line 3 "Zend/zend_language_scanner_defs.h" #line 3 "Zend/zend_language_scanner_defs.h"
enum YYCONDTYPE { enum YYCONDTYPE {