summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2010-08-10 14:52:33 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2010-08-10 14:52:33 -0400
commit55a669bc95cb2831f5a4fc084d2aa828863a1f07 (patch)
tree47b4a09d2970f105ce284d3bc687356fbb48b63b
parent4bc2b6c4388096c65e2b45b186722e32267948d8 (diff)
HTML comments
-rw-r--r--src/urweb.lex3
-rw-r--r--tests/xcomments.ur4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/urweb.lex b/src/urweb.lex
index 8a989884..88b7d857 100644
--- a/src/urweb.lex
+++ b/src/urweb.lex
@@ -173,6 +173,7 @@ ws = [\ \t\012];
intconst = [0-9]+;
realconst = [0-9]+\.[0-9]*;
notags = [^<{\n(]+;
+xcom = ([^-]|(-[^-]))+;
oint = [0-9][0-9][0-9];
xint = x[0-9a-fA-F][0-9a-fA-F];
@@ -207,6 +208,8 @@ xint = x[0-9a-fA-F][0-9a-fA-F];
<COMMENT> "*)" => (exitComment ();
continue ());
+<XML> "<!--" {xcom} "-->" => (continue ());
+
<STRING,CHAR> "\\\"" => (str := #"\"" :: !str; continue());
<STRING,CHAR> "\\'" => (str := #"'" :: !str; continue());
<STRING,CHAR> "\\n" => (str := #"\n" :: !str; continue());
diff --git a/tests/xcomments.ur b/tests/xcomments.ur
index 61a0b34b..83608ff9 100644
--- a/tests/xcomments.ur
+++ b/tests/xcomments.ur
@@ -4,5 +4,7 @@ fun foo () = <xml>Hi!</xml>
fun main () = return <xml><body>
A (* B *) C (* D (* E *) F *) D<br/>
- <b>A</b> <i>(* B *) C <b>D (* E *) F {foo ()}</b></i>
+ <b>A</b> <i>(* B *) C <b>D (* E <!-- 7 --> *) F {foo ()}</b></i>
+ A <!-- B --> C <!-- D (* E *) F --> D<br/>
+ <b>A</b> <i><!-- B --> C <b>D <!-- E --> F {foo ()}</b></i>
</body></xml>