summaryrefslogtreecommitdiff
path: root/src/urweb.lex
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2020-05-30 19:49:56 -0400
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2020-05-30 19:49:56 -0400
commitc2f1e1096f602b1cbd4531352f3e1ea6d656a186 (patch)
treeae102982878bb0c31bdfe07209e60bfc14030490 /src/urweb.lex
parent095c2640aa2070ed4e2765875238d5e6e6673856 (diff)
parent5a0b639dfbd7db9d16c6995f72ba17152a1f362d (diff)
Merge branch 'upstream' into dfsg_clean20200209+dfsgdfsg_clean
Diffstat (limited to 'src/urweb.lex')
-rw-r--r--src/urweb.lex9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/urweb.lex b/src/urweb.lex
index 368b9f1b..23c32ea1 100644
--- a/src/urweb.lex
+++ b/src/urweb.lex
@@ -174,7 +174,7 @@ fun unescape loc s =
%%
%header (functor UrwebLexFn(structure Tokens : Urweb_TOKENS));
%full
-%s COMMENT STRING CHAR XML XMLTAG;
+%s COMMENT XMLCOMMENT STRING CHAR XML XMLTAG;
id = [a-z_][A-Za-z0-9_']*;
xmlid = [A-Za-z][A-Za-z0-9_-]*;
@@ -184,13 +184,12 @@ intconst = [0-9]+;
realconst = [0-9]+\.[0-9]*;
hexconst = 0x[0-9A-F]+;
notags = ([^<{\n(]|(\([^\*<{\n]))+;
-xcom = ([^\-]|(-[^\-]))+;
oint = [0-9][0-9][0-9];
xint = x[0-9a-fA-F][0-9a-fA-F];
%%
-<INITIAL,COMMENT,XMLTAG>
+<INITIAL,COMMENT,XMLTAG,XMLCOMMENT>
\n => (newline yypos;
continue ());
<XML> \n => (newline yypos;
@@ -219,7 +218,9 @@ xint = x[0-9a-fA-F][0-9a-fA-F];
<COMMENT> "*)" => (exitComment ();
continue ());
-<XML> "<!--" {xcom} "-->" => (continue ());
+<XML> "<!--" => (YYBEGIN XMLCOMMENT; continue ());
+<XMLCOMMENT> "-->" => (YYBEGIN XML; continue ());
+<XMLCOMMENT> . => (continue ());
<STRING,CHAR> "\\\"" => (str := #"\"" :: !str; continue());
<STRING,CHAR> "\\'" => (str := #"'" :: !str; continue());