Re: ZEND_ADD_STRING patch
| From: | George Schlossnagle | Date: | Sun, 10 Nov 2002 23:16:01 +0000 |
| Subject: | Re: ZEND_ADD_STRING patch | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-90747@lists.php.net to get a copy of this message | ||
I got the second attachment mail ok.... but I'll just inline it here:
--- Zend/zend_language_scanner.l 2002-11-10 16:53:27.000000000 -0500 +++ /Users/george/src/php4/Zend/zend_language_scanner.l 2002-11-10 16:39:11.000000000 -0500@@ -686,7 +686,6 @@ HNUM "0x"[0-9a-fA-F]+ LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* WHITESPACE [ \n\r\t]+ -LABEL_OR_WHITESPACE [a-zA-Z0-9_\x7f-\xff \n\t\r #'.:;,()|^&+-/*=%!~<>?@]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^&+-/*=%!~$<>?@] ENCAPSED_TOKENS [\[\]{}$] @@ -1266,13 +1265,15 @@ <ST_IN_SCRIPTING>{LABEL} {
zend_copy_value(zendlval, yytext, yyleng);
zendlval->type = IS_STRING;
+ fprintf(stderr, "%s:%d\n", __FILE__,__LINE__);
return T_STRING;
}
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{LABEL_OR_WHITESPACE} {
+<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{LABEL} {
zend_copy_value(zendlval, yytext, yyleng);
zendlval->type = IS_STRING;
+ fprintf(stderr, "%s:%d\n", __FILE__,__LINE__);
return T_STRING;
}
@@ -1572,6 +1573,15 @@
}} + +<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{ESCAPED_AND_WHITESPACE} {
+ HANDLE_NEWLINES(yytext, yyleng); + zendlval->value.str.val = (char *) estrndup(yytext, yyleng); + zendlval->value.str.len = yyleng; + zendlval->type = IS_STRING; + return T_ENCAPSED_AND_WHITESPACE;+} + <ST_SINGLE_QUOTE>([^'\\]|\\[^'\\])+ {
HANDLE_NEWLINES(yytext, yyleng);
zend_copy_value(zendlval, yytext, yyleng);
On Sunday, November 10, 2002, at 06:05 PM, Paul Nicholson wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 It's the list, I don't think they allow attachments....do you have web space you could upload to? On Sunday 10 November 2002 05:16 pm, Derick Rethans wrote:On Sun, 10 Nov 2002, George Schlossnagle wrote:- -- ~Paul Nicholson Design Specialist @ WebPower Design "The web....the way you want it!" paul@webpowerdesign.net www.webpowerdesign.net "It said uses Windows 98 or better, so I loaded Linux!" Registered Linux User #183202 using Register Linux System # 81891 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9zuZNDyXNIUN3+UQRAlYEAJ9PE5IKScOc+7/Kk1a71jJ87o7+EgCfV9z7 u+KZNZj2lZWzXmRiZmYrq4U= =ChWV -----END PGP SIGNATURE-----For those who came to Dan & my or Derick's talk at the Int. PHP Conference, we both covered the bad inefficiency in the parser that results in strings with variables in them being tokenized on whitespace. This results in a huge number of unnecessary opcodes in strings. Attached (hopefully, as my new MUA seems to be fickle) is a first shot at a fix to the parser to keep this from happening, so that you don't need an optimizer to clear up this issue. I've tested this locally. It still introduces a single unnecessary opcode after variable in certain cases, but it works for me.hmm, your MUA is getting senile :) no attachment... Derick