changeset 1741:d6e233db97c8

Reinitialize lexer state properly
author Adam Chlipala <adam@chlipala.net>
date Fri, 04 May 2012 10:07:27 -0400
parents d2ec62c5ad81
children fca4a6d05ac1
files src/urweb.lex tests/badcomment.ur
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/urweb.lex	Thu May 03 10:29:12 2012 -0400
+++ b/src/urweb.lex	Fri May 04 10:07:27 2012 -0400
@@ -40,6 +40,10 @@
   val commentLevel = ref 0
   val commentPos = ref 0
 in
+  fun reset () =
+      (commentLevel := 0;
+       commentPos := 0)
+
   fun enterComment pos =
       (if !commentLevel = 0 then
            commentPos := pos
@@ -109,7 +113,8 @@
 	    braceLevels := (s, i-1) :: rest
       | _ => ()
 
-fun initialize () = (xmlTag := [];
+fun initialize () = (reset ();
+                     xmlTag := [];
 		     xmlString := false)
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/badcomment.ur	Fri May 04 10:07:27 2012 -0400
@@ -0,0 +1,1 @@
+(* uhoh