Re: [PATCH] Scanner fixes and tweaks

From: Date: Thu, 10 Apr 2008 13:50:41 +0000
Subject: Re: [PATCH] Scanner fixes and tweaks
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-36920@lists.php.net to get a copy of this message
Hi Scott, I noticed that Nuno changed yyless() to be like flex after your commit (not in HEAD? I considered that, but figured you guys wanted it different :-)), but now the heredoc end part is wrong again (hehe), and I see Tony reported the broken tests... Attached patch puts it back to pre-re2c state. Also remembered a useless "case EOF;" to remove in zendlex() to match HEAD's (added at end of '05 (v1.647.2.18) for bug #35382, later fixed in the scanner; doesn't look like it ever did much anyway). BTW, maybe you could change the name in that 5.2 NEWS entry to just "Matt"? No big deal, but that's what it's been other than the first few entries. :-) Thanks, Matt ----- Original Message ----- From: "Scott MacVicar" Sent: Tuesday, April 08, 2008 > Thanks Matt, > > I'll review these and merge them in with my other scanner fixes. > > Scott

Index: zend_compile.c =================================================================== RCS file: /repository/ZendEngine2/zend_compile.c,v retrieving revision 1.647.2.27.2.41.2.58 diff -u -r1.647.2.27.2.41.2.58 zend_compile.c --- zend_compile.c 9 Apr 2008 08:55:45 -0000 1.647.2.27.2.41.2.58 +++ zend_compile.c 10 Apr 2008 12:52:00 -0000 @@ -4680,8 +4680,6 @@ case T_END_NOWDOC: efree(Z_STRVAL(zendlval->u.constant)); break; - case EOF: - return EOF; } INIT_PZVAL(&zendlval->u.constant); Index: zend_language_scanner.l =================================================================== RCS file: /repository/ZendEngine2/zend_language_scanner.l,v retrieving revision 1.131.2.11.2.13.2.14 diff -u -r1.131.2.11.2.13.2.14 zend_language_scanner.l --- zend_language_scanner.l 9 Apr 2008 22:01:20 -0000 1.131.2.11.2.13.2.14 +++ zend_language_scanner.l 10 Apr 2008 12:50:00 -0000 @@ -1733,9 +1733,9 @@ /* Go back before last label char, to match in ST_END_HEREDOC state */ yyless(yyleng - 2); - /* Subtract the label/newline length. yyleng must include newline + /* Subtract the remaining label length. yyleng must include newline * before label, for zend_highlight/strip, tokenizer, etc. */ - yyleng -= CG(heredoc_len) + 1; + yyleng -= CG(heredoc_len) - 1; CG(increment_lineno) = 1; /* For newline before label */ BEGIN(ST_END_HEREDOC); @@ -1885,9 +1885,9 @@ /* Go back before last label char, to match in ST_END_NOWDOC state */ yyless(yyleng - 2); - /* Subtract the label/newline length. yyleng must include newline + /* Subtract the remaining label length. yyleng must include newline * before label, for zend_highlight/strip, tokenizer, etc. */ - yyleng -= CG(heredoc_len) + 1; + yyleng -= CG(heredoc_len) - 1; CG(increment_lineno) = 1; /* For newline before label */ BEGIN(ST_END_NOWDOC);
« previous php.internals (#36920) next »