---
src/compiler/scanner.re | 1 +
src/compiler/test/comment | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
create mode 100755 src/compiler/test/comment
diff --git a/src/compiler/scanner.re b/src/compiler/scanner.re
index e42cf21..79c8681 100644
--- a/src/compiler/scanner.re
+++ b/src/compiler/scanner.re
@@ -58,6 +58,7 @@ int scan(struct scanner *s)
/*!re2c
[\x20\n\r\t] { goto std; }
+ "//"[^\n\x00]* { goto std; }
[0-9]+ { return TOK_CONSTANT; }
[0-9]* "." [0-9]* { return TOK_CONSTANT; }
diff --git a/src/compiler/test/comment b/src/compiler/test/comment
new file mode 100755
index 0000000..51fc727
--- /dev/null
+++ b/src/compiler/test/comment
@@ -0,0 +1,43 @@
+#!/bin/sh
+. ./Common
+
+###############################################################################
+
+ptest "comment: line with just // " <<EOF
+// this is a comment
+a = b + c
+EOF
+expect <<EOF
+a = (+ b c)
+EOF
+
+#------------------------------------------------------------------------------
+
+ptest "comment: line ending with // comment" <<EOF
+a = b + c // comment
+d = e + f
+EOF
+expect <<EOF
+a = (+ b c)
+d = (+ e f)
+EOF
+
+#------------------------------------------------------------------------------
+
+ptest "comment: // after //" <<EOF
+a = b + c // comment // more
+d = e + f
+EOF
+expect <<EOF
+a = (+ b c)
+d = (+ e f)
+EOF
+
+#------------------------------------------------------------------------------
+
+ptest "comment: // ending with EOF" "a = b// end"
+expect <<EOF
+a = b
+EOF
+
+###############################################################################
--
1.7.1
_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode