]> granicus.if.org Git - php/commitdiff
- Make one line comments work the same with <script ...> </script> as with
authorAndi Gutmans <andi@php.net>
Thu, 24 Feb 2005 19:25:44 +0000 (19:25 +0000)
committerAndi Gutmans <andi@php.net>
Thu, 24 Feb 2005 19:25:44 +0000 (19:25 +0000)
- other tags. This will break scripts that have whitespace at the end
- of the closing tag </script    > but this is barely used as it is
- and I doubt ppl used whitespace. (patch by Jani)

Zend/zend_language_scanner.l

index 448221408228726bc180d8eee8bfba2f386027bc..f0b624a58d1aa622207343d854c62e96f3f29dd4 100644 (file)
@@ -1433,11 +1433,11 @@ NEWLINE ("\r"|"\n"|"\r\n")
        yymore();
 }
 
-<ST_ONE_LINE_COMMENT>"?"|"%"|">" {
+<ST_ONE_LINE_COMMENT>"?"|"%"|">"|"<" {
        yymore();
 }
 
-<ST_ONE_LINE_COMMENT>[^\n\r?%>]+ {
+<ST_ONE_LINE_COMMENT>[^\n\r?%><]+ {
        yymore();
 }
 
@@ -1450,6 +1450,14 @@ NEWLINE ("\r"|"\n"|"\r\n")
        return T_COMMENT;
 }
 
+<ST_ONE_LINE_COMMENT>"</script>" {
+       zendlval->value.str.val = yytext; /* no copying - intentional */
+       zendlval->value.str.len = yyleng;
+       zendlval->type = IS_STRING;
+       BEGIN(ST_IN_SCRIPTING);
+       return T_COMMENT;
+}
+
 <ST_ONE_LINE_COMMENT>"?>"|"%>" {
     if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */
                zendlval->value.str.val = yytext; /* no copying - intentional */
@@ -1498,7 +1506,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
        yymore();
 }
 
-<ST_IN_SCRIPTING>("?>"|"</script"{WHITESPACE}*">"){NEWLINE}? {
+<ST_IN_SCRIPTING>("?>"|"</script>"){NEWLINE}? {
        zendlval->value.str.val = yytext; /* no copying - intentional */
        zendlval->value.str.len = yyleng;
        zendlval->type = IS_STRING;