Fixed parsing errors

This commit is contained in:
Leeland Heins 2018-12-19 10:36:44 -06:00 committed by GitHub
parent 67840c5ad6
commit 1ad93515af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

18
as65.pl
View File

@ -1913,7 +1913,7 @@ sub parse_line {
my ($line, $lineno) = @_; my ($line, $lineno) = @_;
my ($label, $mnemonic, $operand, $comment) = ('', '', '', ''); my ($label, $mnemonic, $operand, $comment) = ('', '', '', '');
if ($line =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(;.+)$/) { if ($line =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(;.*)$/) {
$label = $1; $label = $1;
$mnemonic = $2; $mnemonic = $2;
$operand = $3; $operand = $3;
@ -1923,7 +1923,7 @@ sub parse_line {
$mnemonic = $2; $mnemonic = $2;
$operand = $3; $operand = $3;
$comment = ''; $comment = '';
} elsif ($line =~ /^\s+(\S+)\s+(\S+)\s+(;.+)$/) { } elsif ($line =~ /^\s+(\S+)\s+(\S+)\s+(;.*)$/) {
$label = ''; $label = '';
$mnemonic = $1; $mnemonic = $1;
$operand = $2; $operand = $2;
@ -1933,7 +1933,7 @@ sub parse_line {
$mnemonic = $1; $mnemonic = $1;
$operand = $2; $operand = $2;
$comment = ''; $comment = '';
} elsif ($line =~ /^\s+(\S+)\s+;\s*$/) { } elsif ($line =~ /^\s+(\S+)\s+(;.*)$/) {
$label = ''; $label = '';
$mnemonic = $1; $mnemonic = $1;
$operand = ''; $operand = '';
@ -1953,22 +1953,22 @@ sub parse_line {
$mnemonic = $2; $mnemonic = $2;
$operand = ''; $operand = '';
$comment = ''; $comment = '';
} elsif ($line =~ /^\s+(\S+)\s+(;.+)$/) { } elsif ($line =~ /^\s+(\S+)\s+(;.*)$/) {
$label = ''; $label = '';
$mnemonic = $1; $mnemonic = $1;
$operand = ''; $operand = '';
$comment = $2; $comment = $2;
} elsif ($line =~ /^(\S+)\s+(\S+)\s+(;.+)$/) { } elsif ($line =~ /^(\S+)\s+(\S+)\s+(;.*)$/) {
$label = $1; $label = $1;
$mnemonic = $2; $mnemonic = $2;
$operand = ''; $operand = '';
$comment = $4; $comment = $3;
} elsif ($line =~ /^(\S+)\s+([Aa][Ss][Cc])\s+(".+")\s+(;.+)$/) { } elsif ($line =~ /^(\S+)\s+([Aa][Ss][Cc])\s+(".+")\s+(;.*)$/) {
$label = $1; $label = $1;
$mnemonic = $2; $mnemonic = $2;
$operand = $3; $operand = $3;
$comment = $4; $comment = $4;
} elsif ($line =~ /^\s+([Aa][Ss][Cc])\s+(".+")\s+(;.+)$/) { } elsif ($line =~ /^\s+([Aa][Ss][Cc])\s+(".+")\s+(;.*)$/) {
$label = ''; $label = '';
$mnemonic = $1; $mnemonic = $1;
$operand = $2; $operand = $2;
@ -2021,7 +2021,7 @@ if (open($ifh, "<$input_file")) {
# Skip comment lines. # Skip comment lines.
next if $line =~ /^\s*;/; next if $line =~ /^\s*;/;
next if $line =~ /\*/; next if $line =~ /^\s*\*/;
# Process .org lines. # Process .org lines.
if ($line =~ /^\.org\s+(.+)/) { if ($line =~ /^\.org\s+(.+)/) {