The original MilkDrop presets are based on INF files and have a
"[preset]" at the beginning that should be ignored.
---
 src/compiler/scanner.re   |    3 +++
 src/compiler/test/comment |   10 ++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/compiler/scanner.re b/src/compiler/scanner.re
index 9db941d..af15c18 100644
--- a/src/compiler/scanner.re
+++ b/src/compiler/scanner.re
@@ -83,6 +83,8 @@ int scan(struct scanner *s)
                                              s->cursor);
                                          goto std; }
 
+               "[preset]"              { goto std; }
+
                [0-9]+                  { return TOK_CONSTANT; }
                [0-9]+ "." [0-9]*       { return TOK_CONSTANT; }
                [0-9]* "." [0-9]+       { return TOK_CONSTANT; }
@@ -108,6 +110,7 @@ int scan(struct scanner *s)
                "tsign"                 { return TOK_TSIGN; }
 
                [a-zA-Z_0-9]+           { return TOK_IDENT; }
+
                "+"                     { return TOK_PLUS; }
                "-"                     { return TOK_MINUS; }
                "*"                     { return TOK_MULTIPLY; }
diff --git a/src/compiler/test/comment b/src/compiler/test/comment
index 916ccb5..3199bd9 100755
--- a/src/compiler/test/comment
+++ b/src/compiler/test/comment
@@ -144,4 +144,14 @@ expect <<EOF
 a = b
 EOF
 
+#------------------------------------------------------------------------------
+
+ptest "comment: [preset]" <<EOF
+  [preset]
+x=y
+EOF
+expect <<EOF
+x = y
+EOF
+
 ###############################################################################
-- 
1.7.1

_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode

Reply via email to