Re: ZEND_ADD_STRING patch

From: Date: Fri, 15 Nov 2002 23:48:55 +0000
Subject: Re: ZEND_ADD_STRING patch
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-91127@lists.php.net to get a copy of this message
Much sexier indeed. There are some flaws with it: o Tokenizes heredocs on whitespace o Doesn't count lines correctly for debug (since strings now have newlines in them) Here's a revised patch to yours that fixes those (heredocs are tokenized on newlines - I think that is best case) Andi Gutmans wrote: > I propose something like the following: (not tested) > It's definitely a sexier patch :) > > Andi > > RCS file: /repository/ZendEngine2/zend_language_scanner.l,v > retrieving revision 1.62 > diff -u -u -r1.62 zend_language_scanner.l > --- zend_language_scanner.l 5 Nov 2002 22:01:35 -0000 1.62 > +++ zend_language_scanner.l 15 Nov 2002 23:22:34 -0000 > @@ -474,6 +474,7 @@ > EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM}) > HNUM "0x"[0-9a-fA-F]+ > LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* > +ENCAPSED_STRING ([a-zA-Z0-9_\x7f-\xff \t\n\r > #'.:;,()|^&+/*=%!~<>?@]|"-"[^>])+ > WHITESPACE [ \n\r\t]+ > TABS_AND_SPACES [ \t]* > TOKENS [;:,.\[\]()|^&+-/*=%!~$<>?@] > @@ -1076,6 +1077,12 @@ > return T_VARIABLE; > } > > +<ST_DOUBLE_QUOTES,ST_BACKQUOTE>{ENCAPSED_STRING} { > + zendlval->value.str.val = (char *)estrndup(yytext, yyleng); > + zendlval->value.str.len = yyleng; > + zendlval->type = IS_STRING; > + return T_STRING; > +} > > <ST_IN_SCRIPTING>{LABEL} { > zendlval->value.str.val = (char *)estrndup(yytext, yyleng); > @@ -1085,7 +1092,7 @@ > } > > > -<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{LABEL} { > +<ST_HEREDOC>{LABEL} { > zendlval->value.str.val = (char *)estrndup(yytext, yyleng); > zendlval->value.str.len = yyleng; > zendlval->type = IS_STRING; > @@ -1374,7 +1381,7 @@ > } > > > -<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{ESCAPED_AND_WHITESPACE} { > +<ST_HEREDOC>{ESCAPED_AND_WHITESPACE} { > HANDLE_NEWLINES(yytext, yyleng); > zendlval->value.str.val = (char *) estrndup(yytext, yyleng); > zendlval->value.str.len = yyleng; > > > > Andi > >

« previous php.dev (#91127) next »