be more relaxed for strings without quotes
check number of macros
This commit is contained in:
+14
-4
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# $Header: /cvs/G/EPICS/App/scripts/dbLoadTemplate,v 1.8 2013/04/15 15:20:42 zimoch Exp $
|
||||
# $Header: /cvs/G/EPICS/App/scripts/dbLoadTemplate,v 1.9 2013/11/13 09:33:12 zimoch Exp $
|
||||
|
||||
use strict;
|
||||
|
||||
@@ -26,7 +26,7 @@ sub nextToken {
|
||||
die "unexpected end of file in $ARGV\n";
|
||||
}
|
||||
}
|
||||
$input =~ s/^\s*($WORD|$STRING|$NOWORD|$SUBST)\s*(#.*\n?)?//;
|
||||
$input =~ s/^\s*($STRING|$SUBST|$WORD|$NOWORD)\s*(#.*\n?)?//;
|
||||
$1 ne $QUOTECHAR or die "unterminated string in $ARGV line $.\n";
|
||||
#print STDERR "nextToken from $ARGV line $. is $1\n";
|
||||
$1;
|
||||
@@ -98,7 +98,7 @@ sub parseRecord {
|
||||
}
|
||||
last if $_ eq "}";
|
||||
push @fields, expect "(", "$WORD field name";
|
||||
push @fields, expect ",", "$STRING quoted field value";
|
||||
push @fields, expect ",", "$STRING|$SUBST quoted field value";
|
||||
expect ")";
|
||||
}
|
||||
handleRecord $rtype,$name,@fields;
|
||||
@@ -124,7 +124,7 @@ sub parseTemplate {
|
||||
sub parseSubst {
|
||||
# print STDERR "parseSubst $ARGV line $.\n";
|
||||
my $filename;
|
||||
eval { $filename = expect "file","$WORD file name" };
|
||||
eval { $filename = expect "file","$STRING|$WORD file name" };
|
||||
if ($@) {
|
||||
$@ =~ /end of file/ or die $@;
|
||||
return 0;
|
||||
@@ -145,6 +145,11 @@ sub parseSubst {
|
||||
expect "=", "$STRING|$SUBST value for $macro";
|
||||
$subst{$macro} = $_;
|
||||
}
|
||||
my $n;
|
||||
$n = scalar (keys %subst);
|
||||
if ($n > 100) {
|
||||
print STDERR "Warning: more than 100 marcos ($n in your case) is not supported\n";
|
||||
}
|
||||
eval {parseTemplate $filename} or die "$@called from $ARGV line $.\n";
|
||||
expect "{|} '{' or '}'";
|
||||
} while $_ eq "{";
|
||||
@@ -159,6 +164,11 @@ sub parseSubst {
|
||||
last if $_ eq '}';
|
||||
push @macros, $_;
|
||||
};
|
||||
my $n;
|
||||
$n = scalar (@macros);
|
||||
if ($n > 100) {
|
||||
print STDERR "Warning: more than 100 marcos ($n in your case) is not supported\n";
|
||||
}
|
||||
while (1) {
|
||||
local %subst;
|
||||
expect "{|} '{' or '}'";
|
||||
|
||||
Reference in New Issue
Block a user