Skip to content

Commit 95f2b7a

Browse files
committed
Parse line-continuations when reading definitions.units.patched
1 parent 5af8365 commit 95f2b7a

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

load-units.pl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,33 @@
2222

2323
my $skip_british = 0;
2424
my @todo;
25+
my $continued = '';
2526

2627
while (<F>) {
2728
# skip over locale specific parts
2829
$skip_british = 1 if /^!var UNITS_ENGLISH GB/;
2930
$skip_british = 0 if /^!endvar/;
3031
next if ($skip_british);
3132

33+
if (/\s*(.*)\\$/) {
34+
$continued .= $1;
35+
next;
36+
} elsif ($continued) {
37+
s/^\s*//;
38+
$_ = "$continued$_";
39+
$continued = '';
40+
}
41+
3242
s/#.*//;
3343
s/\s+$//;
3444
next if /^\s*$/; # skip emtpy lines
3545
next if /^!/; # skip pragmas
3646
next if /^\+/; # skip units from non-SI systems
37-
next if /^[0-9]/; # skip over table contents
38-
next if /^\s/; # skip over table contents/continued lines
47+
#next if /^[0-9]/; # skip over table contents
48+
#next if /^\s/; # skip over table contents/continued lines
3949
unless (/^(\S+)\s+(.*)/) {
40-
print "skipping $_\n";
41-
next;
50+
print "unknown line $_\n";
51+
exit 1;
4252
}
4353

4454
my ($unit, $def) = ($1, $2);

0 commit comments

Comments
 (0)