diff options
Diffstat (limited to 'sbolint')
-rwxr-xr-x | sbolint | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -844,6 +844,8 @@ sub check_info { my @keys; my $continuation = 0; + my $fixable = 0; + # parse and bitch about bad syntax... for(@lines) { $file_lineno++; @@ -863,20 +865,24 @@ sub check_info { if(/^\s*$/) { log_error("$file:$lineno: blank line (get rid of it)"); + $fixable++; next; } unless(/=/) { log_error("$file:$lineno: malformed line (no = sign, missing \\ on prev line?)"); + $fixable++; next; } if(s/^\s+//) { log_error("$file:$lineno: leading whitespace before key"); + $fixable++; } if(s/\s+$//) { log_error("$file:$lineno: trailing whitespace at EOL"); + $fixable++; } if(my ($k, $s1, $s2, $q1, $val, $q2) = /^(\w+)(\s*)=(\s*)("?)(.*?)("?)$/) { @@ -885,37 +891,48 @@ sub check_info { } else { if($k ne $expected[$next_exp]) { log_warning("$file:$lineno: out of order, expected $expected[$next_exp], got $k"); + $fixable++; } $next_exp++; } if(not $q1) { log_error("$file:$lineno: missing opening double-quote"); + $fixable++; } if(not $q2) { log_error("$file:$lineno: missing closing double-quote"); + $fixable++; } if(length($s1) || length($s2)) { log_error("$file:$lineno: no spaces allowed before/after = sign"); + $fixable++; } my $oldval = $val; if($val =~ s/^\s+//) { log_error("$file:$lineno: leading space in value: \"$oldval\""); + $fixable++; } if($val =~ s/\s+$//) { log_error("$file:$lineno: trailing space in value: \"$oldval\""); + $fixable++; } $info{$k} = $val; } else { log_error("$file:$lineno: malformed line"); + $fixable++; } } + if($fixable) { + logmsg("NOTE", $fixable . " possibly-fixable errors found. suggest running sbofixinfo."); + } + # parsing done, now for semantic checks my @missing; |