changeset 1284:43ca083678f8

HTML comments
author Adam Chlipala <adam@chlipala.net>
date Tue, 10 Aug 2010 14:52:33 -0400 (2010-08-10)
parents b04354e24d1b
children 514be09d5018
files src/urweb.lex tests/xcomments.ur
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/urweb.lex	Tue Aug 10 14:44:26 2010 -0400
+++ b/src/urweb.lex	Tue Aug 10 14:52:33 2010 -0400
@@ -173,6 +173,7 @@
 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 @@
 <COMMENT> "*)"        => (exitComment ();
 			  continue ());
 
+<XML> "<!--" {xcom} "-->" => (continue ());
+
 <STRING,CHAR> "\\\""  => (str := #"\"" :: !str; continue());
 <STRING,CHAR> "\\'"   => (str := #"'" :: !str; continue());
 <STRING,CHAR> "\\n"   => (str := #"\n" :: !str; continue());
--- a/tests/xcomments.ur	Tue Aug 10 14:44:26 2010 -0400
+++ b/tests/xcomments.ur	Tue Aug 10 14:52:33 2010 -0400
@@ -4,5 +4,7 @@
 
 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>