{
my ($var, $var_is_am, $type, $cond_string, $value, $where) = @_;
+ if (defined $contents{$1}
+ && ($cond_string
+ ? ! defined $conditional{$1}
+ : defined $conditional{$1}))
+ {
+ &am_line_error ($1,
+ "$1 defined both conditionally and unconditionally");
+ }
+
if (! defined $contents{$var})
{
# The first assignment to a macro sets the line
${$conditional{$var}}{$cond_string} = $value;
}
}
+
+ # FIXME: I don't understand what's so special wrt `:', nor
+ # why we forget the `+' nature of a var.
+ $def_type{$var} = ($type eq ':') ? ':' : '';
+ push (@var_list, $var);
}
elsif (($is_ok_macro = /$MACRO_PATTERN/o)
|| /$BOGUS_MACRO_PATTERN/o)
{
+ # Error if bogus.
+ &am_line_error ($., "bad macro name `$last_var_name'")
+ if ! $is_ok_macro;
+
# Found a macro definition.
$was_rule = 0;
$last_var_name = $1;
- if (defined $contents{$1}
- && (@conditional_stack
- ? ! defined $conditional{$1}
- : defined $conditional{$1}))
- {
- &am_line_error ($1,
- "$1 defined both conditionally and unconditionally");
- }
- my $value;
+ my $type = $2;
+ my $value = $3;
if ($3 ne '' && substr ($3, -1) eq "\\")
{
# We preserve the `\' because otherwise the long lines
# `sed's.
$value = $3 . "\n";
}
- else
- {
- $value = $3;
- }
- my $type = $2;
macro_define ($last_var_name, 0, $type,
conditional_string (@conditional_stack),
# all comments for a given variable, no matter where
# defined.
$am_vars{$last_var_name} = $comment . $spacing;
- $def_type{$last_var_name} = ($type eq ':') ? ':' : '';
- push (@var_list, $last_var_name);
+
$comment = $spacing = '';
$saw_bk = /\\$/;
-
- # Error if bogus.
- &am_line_error ($., "bad macro name `$last_var_name'")
- if ! $is_ok_macro;
}
elsif (/$INCLUDE_PATTERN/o)
{