- next unless s/^%(token|type)\s+<opval>\s+//;
- $tokens{$_} =1 for (split ' ', $_);
+ if (/(\$\d+)\s*=[^=]/) {
+ warn "$y_file:$.: dangerous assignment to $1: $_";
+ }
+
+ if (/__DEFAULT__/) {
+ m{(\w+) \s* ; \s* /\* \s* __DEFAULT__}x
+ or die "$y_file: can't parse __DEFAULT__ line: $_";
+ die "$y_file: duplicate __DEFAULT__ line: $_"
+ if defined $default_token;
+ $default_token = $1;
+ next;
+ }
+
+ next unless /^%(token|type)/;
+ s/^%((token)|type)\s+<(\w+)>\s+//
+ or die "$y_file: unparseable token/type line: $_";
+ for (split ' ', $_) {
+ $tokens{$_} = $3;
+ if ($2) {
+ $just_tokens{$_} = $3;
+ }
+ }
+ $types{$3} = 1;