Author: coke
Date: Sun Aug 7 10:49:27 2005
New Revision: 8856
Modified:
trunk/languages/tcl/lib/parser.pir
trunk/languages/tcl/t/tcl_misc.t
Log:
tcl: fix comment parsing, add a test.
Modified: trunk/languages/tcl/lib/parser.pir
==============================================================================
--- trunk/languages/tcl/lib/parser.pir (original)
+++ trunk/languages/tcl/lib/parser.pir Sun Aug 7 10:49:27 2005
@@ -48,8 +48,16 @@ get_commands:
next_command:
# Do we have a comment? If so, skip to the next position where
# We might have a command.
- pos = skip_comment(tcl_code, pos)
+ .local int check_pos
+ check_pos = skip_comment(tcl_code, pos)
+ if check_pos != pos goto found_comment
+ goto done_comment
+found_comment:
+ pos = check_pos
+ goto next_command
+
+done_comment:
.local pmc command
(command, pos) = get_command(tcl_code, chars, pos)
isnull command, done
Modified: trunk/languages/tcl/t/tcl_misc.t
==============================================================================
--- trunk/languages/tcl/t/tcl_misc.t (original)
+++ trunk/languages/tcl/t/tcl_misc.t Sun Aug 7 10:49:27 2005
@@ -2,7 +2,7 @@
use strict;
use lib qw(tcl/t t . ../lib ../../lib ../../../lib);
-use Parrot::Test tests => 16;
+use Parrot::Test tests => 17;
use Test::More;
use vars qw($TODO);
@@ -105,6 +105,14 @@ language_output_is("tcl",<<'TCL',<<'OUT'
puts 2
TCL
2
+OUT
+
+language_output_is("tcl",<<'TCL',<<'OUT',"two comments in a row should work");
+ # comment1
+ # comment2
+ puts 2
+TCL
+2
OUT
TODO: {