cvsuser 03/12/03 06:03:19
Modified: imcc imcc.l
imcc/t/syn clash.t
Log:
allow comment after setline
Revision Changes Path
1.80 +2 -2 parrot/imcc/imcc.l
Index: imcc.l
===================================================================
RCS file: /cvs/public/parrot/imcc/imcc.l,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -w -r1.79 -r1.80
--- imcc.l 24 Nov 2003 06:03:23 -0000 1.79
+++ imcc.l 3 Dec 2003 14:03:14 -0000 1.80
@@ -128,7 +128,7 @@
valp->s = str_dup(yytext);
return FILECOMMENT;
}
-<cmt3>["]{EOL} { BEGIN(prev_state) ; line++; }
+<cmt3>["] { BEGIN(cmt4); }
<*>setfile{SP}+["] { prev_state = YYSTATE; BEGIN(cmt2); }
<*>setline{SP}+ { prev_state = YYSTATE; BEGIN(cmt1); }
@@ -137,7 +137,7 @@
BEGIN(cmt4);
return LINECOMMENT;
}
-<cmt4>{WS}*{EOL} { BEGIN(prev_state) ; line++; }
+<cmt4>.*{EOL} { BEGIN(prev_state) ; line++; }
<INITIAL,emit>{EOL} {
if (expect_pasm == 2)
1.10 +21 -1 parrot/imcc/t/syn/clash.t
Index: clash.t
===================================================================
RCS file: /cvs/public/parrot/imcc/t/syn/clash.t,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -r1.9 -r1.10
--- clash.t 23 Oct 2003 17:03:01 -0000 1.9
+++ clash.t 3 Dec 2003 14:03:19 -0000 1.10
@@ -1,6 +1,6 @@
#!perl
use strict;
-use TestCompiler tests => 9;
+use TestCompiler tests => 11;
##############################
output_is(<<'CODE', <<'OUT', "if/unless");
@@ -173,6 +173,26 @@
.end
CODE
/error:\w+:Unknown PMC type 'INTVAL'/
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "setline w comment");
+.sub _main
+ setline 1 # comment
+ print "ok\n"
+ end
+.end
+CODE
+ok
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "setfile w comment");
+.sub _main
+ setfile "foo" # comment
+ print "ok\n"
+ end
+.end
+CODE
+ok
OUTPUT
1;