cvs: php4 /ext/midgard preparser-scanner.l
| From: | David Guerizec | Date: | Tue, 13 Mar 2001 08:03:08 +0000 |
| Subject: | cvs: php4 /ext/midgard preparser-scanner.l | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-4527@lists.php.net to get a copy of this message | ||
davidg Tue Mar 13 00:03:08 2001 EDT
Modified files:
/php4/ext/midgard preparser-scanner.l
Log:
Fixed a bug that prevented the preparser to expand any Midgard syntax formatter after a //-style
comment anywhere in the page.
Index: php4/ext/midgard/preparser-scanner.l
diff -u php4/ext/midgard/preparser-scanner.l:1.5 php4/ext/midgard/preparser-scanner.l:1.6
--- php4/ext/midgard/preparser-scanner.l:1.5 Fri Feb 23 16:00:59 2001
+++ php4/ext/midgard/preparser-scanner.l Tue Mar 13 00:03:08 2001
@@ -1,6 +1,6 @@
%{
-/* $Id: preparser-scanner.l,v 1.5 2001/02/24 00:00:59 davidg Exp $
+/* $Id: preparser-scanner.l,v 1.6 2001/03/13 08:03:08 davidg Exp $
Copyright (C) 1999 Jukka Zitting <jukka.zitting@iki.fi>
Copyright (C) 2000 The Midgard Project ry
Copyright (C) 2000 Emile Heyns, Aurora SA <emile@iris-advies.com>
@@ -29,17 +29,10 @@
static int par_stack;
static char in_string=0;
-/*
-<IN_PHP>{ANY}|{LCOMMENT} {
-#ifdef SCANNER_DEBUG
- mgd_append_output_buffer_const(" <6: misc char> ");
-#endif
- mgd_append_output_buffer(yytext);
-}
-*/
%}
%x IN_PHP
+%x IN_LCOMMENT
%x IN_TEMPLATE
%x IN_FORMAT
%x IN_SNIPPET
@@ -60,7 +53,7 @@
qstring [\'][^\'\n]*[\']
WHITESPACE [ \n\r\t]
ANY .|{WHITESPACE}
-LCOMMENT "//".*
+LCOMMENT "//"
quote [\']
dquote [\"]
MIDGARD_TEMPLATE_NAME [a-zA-Z0-9_ \x7f-\xff-]+
@@ -90,12 +83,30 @@
mgd_append_output_buffer(yytext);
yy_pop_state();
}
+
+<IN_PHP>{ANY} {
+#ifdef SCANNER_DEBUG
+ mgd_append_output_buffer_const(" <6: misc char> ");
+#endif
+ mgd_append_output_buffer(yytext);
+}
-<IN_PHP>{ANY}|{LCOMMENT} {
+<IN_PHP>{LCOMMENT} {
#ifdef SCANNER_DEBUG
mgd_append_output_buffer_const(" <6: misc char> ");
#endif
mgd_append_output_buffer(yytext);
+ yy_push_state(IN_LCOMMENT);
+}
+
+<IN_LCOMMENT>("\n"|"?>"|"</script"{WHITESPACE}*">")
{
+#ifdef SCANNER_DEBUG
+ mgd_append_output_buffer_const(" <4: Found php end> ");
+#endif
+ mgd_append_output_buffer(yytext);
+ yy_pop_state(); // pop IN_LCOMMENT
+ if(*yytext != '\n')
+ yy_pop_state(); // pop IN_PHP
}
<IN_PHP>{qstring}|{dqstring} {