summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2012-05-04 10:07:27 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2012-05-04 10:07:27 -0400
commit75fa1fd2ad8aae9a88dfacd1a85eb80f645a3b74 (patch)
tree8588b4f96df22035fb8c6cf80ab8d705545141c5
parent2ea8a7342ff813ac96fa81770586f69c03dccbc6 (diff)
Reinitialize lexer state properly
-rw-r--r--src/urweb.lex7
-rw-r--r--tests/badcomment.ur1
2 files changed, 7 insertions, 1 deletions
diff --git a/src/urweb.lex b/src/urweb.lex
index 55fe4216..5d3d6dbe 100644
--- a/src/urweb.lex
+++ b/src/urweb.lex
@@ -40,6 +40,10 @@ local
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 @@ fun exitBrace () =
braceLevels := (s, i-1) :: rest
| _ => ()
-fun initialize () = (xmlTag := [];
+fun initialize () = (reset ();
+ xmlTag := [];
xmlString := false)
diff --git a/tests/badcomment.ur b/tests/badcomment.ur
new file mode 100644
index 00000000..099d449a
--- /dev/null
+++ b/tests/badcomment.ur
@@ -0,0 +1 @@
+(* uhoh