|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-06-27 06:00 UTC] alan_k@php.net
Description:
------------
single line file:
<?php if (1) { ?>#<?php } ?>
produces a parse error:
get's caught with this rule from the re2c scanner.
<INITIAL>"#".+ {NEWLINE} {
if ((YYCTYPE*)yytext == SCNG(yy_start)) {
/* ignore first line when it's started with a # */
goto restart;
} else {
goto inline_char_handler;
}
}
basically the scanner runs off the end, and eats everything after the #
I've fixed it by changing the above to something like:
} else {
/* shunt back to just return the # on it's own.. */
YYCURSOR = YYMARKER;
yyleng = 1;
goto inline_char_handler;
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 11:00:01 2025 UTC |
Not sure why re2c needs to deal with the #bang situation looking at the code it would be better to eat that line outside of the lexer.. Something like: int ini_lex(zval *ini_lval TSRMLS_DC) { if ((YYCTYPE*)yytext == SCNG(yy_start) && *yych == '#') { while(*yych != '\n' && *yych != '\n' && yych < yyend) { yych++; } while((*yych == '\n' || *yych == '\n') && yych < yyend) { yych++; } YYCURSOR = yych; } .....