]> granicus.if.org Git - php/commitdiff
Honor a semicolon on the same line as an ending token of a heredoc
authorZeev Suraski <zeev@php.net>
Fri, 9 Apr 1999 11:19:03 +0000 (11:19 +0000)
committerZeev Suraski <zeev@php.net>
Fri, 9 Apr 1999 11:19:03 +0000 (11:19 +0000)
Zend/zend-scanner.l

index 03131240d993c79dc6b5a2d682a942a6b06694d0..3b359dd3b175bb82c5c3f2fccb5faf5402c10c65 100644 (file)
@@ -1010,16 +1010,27 @@ TLS_VARS;
 }
 
 
-<HEREDOC>^{LABEL}("\r")?"\n" {
+<HEREDOC>^{LABEL}(";")?("\r")?"\n" {
        int label_len;
+       unsigned char unput_semicolon;
 
        if (yytext[yyleng-2]=='\r') {
                label_len = yyleng-2;
        } else {
                label_len = yyleng-1;
        }
+       
+       if (yytext[label_len-1]==';') {
+               label_len--;
+               unput_semicolon=1;
+       } else{
+               unput_semicolon=0;
+       }
 
        if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) {
+               if (unput_semicolon) {
+                       unput(';');
+               }
                efree(CG(heredoc));
                CG(heredoc)=NULL;
                CG(heredoc_len)=0;