Fixed parsing bug

This commit is contained in:
Leeland Heins 2018-12-18 12:29:44 -06:00 committed by GitHub
parent 35940077f5
commit 394479783e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

10
as65.pl
View File

@ -1975,6 +1975,11 @@ sub parse_line {
$mnemonic = $1; $mnemonic = $1;
$operand = ''; $operand = '';
$comment = $2; $comment = $2;
} elsif ($line =~ /^(\S+)\s+(\S+)\s+(;.+)$/) {
$label = $1;
$mnemonic = $2;
$operand = '';
$comment = $4;
} else { } else {
print "SYNTAX ERROR! $lineno : $line\n"; print "SYNTAX ERROR! $lineno : $line\n";
} }
@ -2065,6 +2070,8 @@ if (open($ifh, "<$input_file")) {
$symbol =~ s/:$//; $symbol =~ s/:$//;
print "%%%% Saving Symbol $symbol $operand\n" if $verbose; print "%%%% Saving Symbol $symbol $operand\n" if $verbose;
$symbols{$symbol} = $operand; $symbols{$symbol} = $operand;
} elsif ($ucmnemonic eq 'OBJ') {
# Just ignore this
# Mnemonic Addressing mode Form Opcode Size Timing # Mnemonic Addressing mode Form Opcode Size Timing
} elsif (defined $mnemonics{$ucmnemonic}) { } elsif (defined $mnemonics{$ucmnemonic}) {
my $foundit = 0; my $foundit = 0;
@ -2140,9 +2147,10 @@ if (open($ifh, "<$input_file")) {
my $ucmnemonic = uc($mnemonic); my $ucmnemonic = uc($mnemonic);
# Skip ORG and EQU on pass 2. # Skip ORG, EQU and OBJ on pass 2.
next if $ucmnemonic =~ /ORG/i; next if $ucmnemonic =~ /ORG/i;
next if $ucmnemonic =~ /EQU|\.EQ/i; next if $ucmnemonic =~ /EQU|\.EQ/i;
next if $ucmnemonic =~ /OBJ/i;
if (defined $mnemonics{$ucmnemonic}) { if (defined $mnemonics{$ucmnemonic}) {
my $foundit = 0; my $foundit = 0;