- Add two checks for syntax errors
- Improve error reporting - Remove redundant conditionals
This commit is contained in:
parent
f69ec7af12
commit
44d6e87b07
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159083
@ -47,6 +47,7 @@ function usage()
|
||||
|
||||
function die(msg, what)
|
||||
{
|
||||
printf srcfile "(" fnr "): " > "/dev/stderr";
|
||||
printf msg "\n", what > "/dev/stderr";
|
||||
exit 1;
|
||||
}
|
||||
@ -189,13 +190,16 @@ if (cfile) {
|
||||
}
|
||||
|
||||
while ((getline < srcfile) > 0) {
|
||||
fnr++;
|
||||
if (NF == 0)
|
||||
continue;
|
||||
if ($1 ~ /^%%/) {
|
||||
if (NF != 6 || $1 != "%%" || \
|
||||
$2 !~ /^[a-z]+$/ || $3 !~ /^[a-z]+$/ || \
|
||||
$4 !~ /^.$/ || $5 !~ /^.$/ || $6 !~ /^.$/)
|
||||
if (NF != 6 ||
|
||||
$2 !~ /^[a-z]+$/ || $3 !~ /^[a-z]+$/ ||
|
||||
$4 !~ /^.$/ || $5 !~ /^.$/ || $6 !~ /^.$/) {
|
||||
die("Invalid %s construction", "%%");
|
||||
continue;
|
||||
}
|
||||
lockdata["vop_" $2, $3, "Entry"] = $4;
|
||||
lockdata["vop_" $2, $3, "OK"] = $5;
|
||||
lockdata["vop_" $2, $3, "Error"] = $6;
|
||||
@ -203,14 +207,15 @@ while ((getline < srcfile) > 0) {
|
||||
}
|
||||
|
||||
if ($1 ~ /^%!/) {
|
||||
if (NF != 4 || $1 != "%!")
|
||||
continue;
|
||||
if ($3 != "pre" && $3 != "post")
|
||||
if (NF != 4 ||
|
||||
($3 != "pre" && $3 != "post")) {
|
||||
die("Invalid %s construction", "%!");
|
||||
continue;
|
||||
}
|
||||
lockdata["vop_" $2, $3] = $4;
|
||||
continue;
|
||||
}
|
||||
if ($1 ~ /^#/ || $0 ~ /^$/)
|
||||
if ($1 ~ /^#/)
|
||||
continue;
|
||||
|
||||
# Get the function name.
|
||||
@ -225,6 +230,7 @@ while ((getline < srcfile) > 0) {
|
||||
die("Unable to read through the arguments for \"%s\"",
|
||||
name);
|
||||
}
|
||||
fnr++;
|
||||
if ($1 ~ /^\};/)
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user