cvsuser 02/07/17 19:13:27
Modified: . assemble.pl
Log:
From: Tom Hughes <[EMAIL PROTECTED]>
Subject: Re: [netlabs #757] Problem mixing labels, comments and quote-marks
Revision Changes Path
1.82 +4 -1 parrot/assemble.pl
Index: assemble.pl
===================================================================
RCS file: /cvs/public/parrot/assemble.pl,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -w -r1.81 -r1.82
--- assemble.pl 17 Jul 2002 03:45:27 -0000 1.81
+++ assemble.pl 18 Jul 2002 02:13:27 -0000 1.82
@@ -427,10 +427,13 @@
sub _annotate_contents {
my ($self,$line) = @_;
+ my $str_re = qr(\"(?:[^\\\"]*(?:\\.[^\\\"]*)*)\" |
+ \'(?:[^\\\']*(?:\\.[^\\\']*)*)\'
+ )x;
$self->{pc}++;
return if $line=~/^\s*$/ or $line=~/^\s*#/; # Filter out the comments and blank
lines
- $line=~s/#[^'"]+$//; # Remove trailing comments
+ $line=~s/^((?:[^'"]+|$str_re)*)#.*$/$1/; # Remove trailing comments
$line=~s/(^\s+|\s+$)//g; # Remove leading and trailing whitespace
#
# Accumulate lines that only have labels until an instruction is found.