* src/symtab.c (symbol_check_alias_consistency): Also check

type names, destructors, and printers.
Reported by Alexandre Duret-Lutz.
Recode the handling of associativity and precedence in terms
of symbol_precedence_set.
Accept no redeclaration at all, not even equal to the previous
value.
(redeclaration): New.
Use it to factor redeclaration complaints.
(symbol_make_alias): Don't set the type of the alias, let
symbol_check_alias_consistency do it as for other features.
* src/symtab.h (symbol): Add new member prec_location, and
type_location.
* src/symtab.c (symbol_precedence_set, symbol_type_set): Set them.
* tests/input.at (Incompatible Aliases): New.
This commit is contained in:
Akim Demaille
2004-10-11 09:03:55 +00:00
parent 2ed24dd8c7
commit df09ef2e8f
4 changed files with 128 additions and 39 deletions

View File

@@ -1,5 +1,5 @@
# Checking the Bison scanner. -*- Autotest -*-
# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -82,6 +82,43 @@ input.y:6.5: warning: empty rule for typed nonterminal, and no action
AT_CLEANUP
## ---------------------- ##
## Incompatible Aliases. ##
## ---------------------- ##
AT_SETUP([Incompatible Aliases])
AT_DATA([input.y],
[[%token foo "foo"
%type <bar> foo
%printer {bar} foo
%destructor {bar} foo
%left foo
%type <baz> "foo"
%printer {baz} "foo"
%destructor {baz} "foo"
%left "foo"
%%
exp: foo;
]])
AT_CHECK([bison input.y], [1], [],
[[input.y:8.7-11: %type redeclaration for foo
input.y:3.7-11: first declaration
input.y:10.13-17: %destructor redeclaration for foo
input.y:5.13-17: first declaration
input.y:9.19-23: %printer redeclaration for foo
input.y:10.13-17: first declaration
input.y:11.1-5: %left redeclaration for foo
input.y:6.1-5: first declaration
]])
AT_CLEANUP
## ----------------------- ##
## Torturing the Scanner. ##