Derick Rethans wrote: > On Wed, 30 Jan 2002, Yasuo Ohgaki wrote: > > >>Zak Greant wrote: >> >>> I talked to [EMAIL PROTECTED] about this quite some time ago. IIRC, we >>> agreed that <<- heredoc syntax was an acceptable way to handle this. >>> The <<- syntax would work like the same way as <<- in bash. >>> >>> >>Hi Zak, >>I worked for you :) >> > > Did you actually test this? >
In fact, I didn't. This one is much better and supposed to be valid one. (I spend more than 30 min this time. But it may not be enough. If it's bad, please fix or create new one :) Question is: Do we really need/want this? Even if I made this patch, I'm somewhere between 0 and -1 for this change. BTW, Zend does not complain for following line. (with or without this patch) SOME_LABEL_NOT_DEFINED; Is this intended behavior? -- Yasuo Ohgaki
Index: Zend/zend_language_scanner.l =================================================================== RCS file: /repository/Zend/zend_language_scanner.l,v retrieving revision 1.43 diff -u -r1.43 zend_language_scanner.l --- Zend/zend_language_scanner.l 2002/01/06 15:21:09 1.43 +++ Zend/zend_language_scanner.l 2002/01/31 09:09:30 @@ -1256,9 +1256,11 @@ } -<ST_HEREDOC>^{LABEL}(";")?{NEWLINE} { +<ST_HEREDOC>^{TABS_AND_SPACES}{LABEL}(";")?{NEWLINE} { int label_len; unsigned char unput_semicolon; + int tabs_and_spaces = 0; + void *tmp; CG(zend_lineno)++; if (yytext[yyleng-2]=='\r') { @@ -1273,8 +1275,12 @@ } else{ unput_semicolon=0; } + + if (yytext[tabs_and_spaces] == ' ' || yytext[tabs_and_spaces] == '\t') + for (; yytext[tabs_and_spaces] == ' ' || yytext[tabs_and_spaces] == '\t'; +tabs_and_spaces++); - if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) { + tmp =(char *)yytext+tabs_and_spaces; + if (label_len - tabs_and_spaces ==CG(heredoc_len) && !memcmp(tmp, CG(heredoc), +label_len - tabs_and_spaces)) { zendlval->value.str.val = estrndup(yytext, yyleng); /* unput destroys yytext */ zendlval->value.str.len = yyleng; if (unput_semicolon) {
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]