scanner: testfaelle und newline fix fuer kommentare
authorBernhard Urban <lewurm@gmail.com>
Sun, 7 Mar 2010 13:48:17 +0000 (14:48 +0100)
committerBernhard Urban <lewurm@gmail.com>
Sun, 7 Mar 2010 13:48:53 +0000 (14:48 +0100)
scanner/Makefile
scanner/scanner.lex
scanner/test/1test [new file with mode: 0644]
scanner/test/2test [new file with mode: 0644]

index 3997a410238457d16bcd67e63855483f32a494dc..8f7f12c75b2881baecb563120df0e8bedbeec843 100755 (executable)
@@ -12,8 +12,10 @@ clean:
        rm -f $(NAME).o $(NAME) $(NAME).c
 
 1test: $(NAME)
-       @echo "execute ./$(NAME)"
-       @./$(NAME)
+       @echo "execute cat test/1test | ./$(NAME)"
+       @cat test/1test | ./$(NAME)
+       @echo "execute cat test/2test | ./$(NAME)"
+       @cat test/2test | ./$(NAME)
 
 2test:
        /usr/ftp/pub/ublu/test/$(NAME)/test 2>&1
index 6288282a16efe8a28441b6cb7f035b0e1e19eea9..b86baaf732824b3f43bb0529f92c461d331ce960 100644 (file)
@@ -22,6 +22,8 @@ COMMENT_END   \*\/
 
 <COMMENT><<EOF>> { (void) fprintf(stderr, "kommentar nicht geschlossen\n"); exit(1); }
 
+<COMMENT>{WHITESPACE} /* ignorieren */
+
 <COMMENT>. /* alles im kommentar wird ignoriert */
 
 {KEYWORD} printf("%s\n", yytext);
diff --git a/scanner/test/1test b/scanner/test/1test
new file mode 100644 (file)
index 0000000..9ab5ac8
--- /dev/null
@@ -0,0 +1,11 @@
+method blabb
+var foo := 5;
+if foo < 0x0F3 then
+ /* hier
+  kommt komm
+ mentar
+ */
+ foo := foo - 0x3;
+else
+ foo := foo * 4;
+end
diff --git a/scanner/test/2test b/scanner/test/2test
new file mode 100644 (file)
index 0000000..8e1597a
--- /dev/null
@@ -0,0 +1,7 @@
+method blabb
+var foo := 5;
+if foo < 0x0F3 then
+ foo := foo - 0x3;
+else
+ foo := foo * 4;
+end