* src/symtab.h, src/symtab.c (symbol_type_set)

(symbol_destructor_set, symbol_precedence_set): The location is
the last argument.
Adjust all callers.
This commit is contained in:
Akim Demaille
2002-06-20 11:20:25 +00:00
parent e776192e4f
commit 1a31ed21b1
5 changed files with 34 additions and 26 deletions

View File

@@ -1250,7 +1250,7 @@ yyreduce:
{
symbol_list_t *list;
for (list = yyvsp[0].list; list; list = list->next)
symbol_destructor_set (list->sym, list->location, yyvsp[-1].string);
symbol_destructor_set (list->sym, yyvsp[-1].string, yylsp[-1]);
symbol_list_free (yyvsp[0].list);
current_braced_code = action_braced_code;
}
@@ -1303,7 +1303,7 @@ yyreduce:
{
symbol_list_t *list;
for (list = yyvsp[0].list; list; list = list->next)
symbol_type_set (list->sym, list->location, yyvsp[-1].string);
symbol_type_set (list->sym, yyvsp[-1].string, yylsp[-1]);
symbol_list_free (yyvsp[0].list);
}
break;
@@ -1315,8 +1315,8 @@ yyreduce:
++current_prec;
for (list = yyvsp[0].list; list; list = list->next)
{
symbol_type_set (list->sym, list->location, current_type);
symbol_precedence_set (list->sym, list->location, current_prec, yyvsp[-2].assoc);
symbol_type_set (list->sym, current_type, yylsp[-1]);
symbol_precedence_set (list->sym, current_prec, yyvsp[-2].assoc, yylsp[-2]);
}
symbol_list_free (yyvsp[0].list);
current_type = NULL;
@@ -1369,7 +1369,7 @@ yyreduce:
#line 288 "parse-gram.y"
{
symbol_class_set (yyvsp[0].symbol, current_class, yylsp[0]);
symbol_type_set (yyvsp[0].symbol, yylsp[0], current_type);
symbol_type_set (yyvsp[0].symbol, current_type, yylsp[0]);
}
break;
@@ -1377,7 +1377,7 @@ yyreduce:
#line 293 "parse-gram.y"
{
symbol_class_set (yyvsp[-1].symbol, current_class, yylsp[-1]);
symbol_type_set (yyvsp[-1].symbol, yylsp[-1], current_type);
symbol_type_set (yyvsp[-1].symbol, current_type, yylsp[-1]);
symbol_user_token_number_set (yyvsp[-1].symbol, yyvsp[0].integer, yylsp[0]);
}
break;
@@ -1386,7 +1386,7 @@ yyreduce:
#line 299 "parse-gram.y"
{
symbol_class_set (yyvsp[-1].symbol, current_class, yylsp[-1]);
symbol_type_set (yyvsp[-1].symbol, yylsp[-1], current_type);
symbol_type_set (yyvsp[-1].symbol, current_type, yylsp[-1]);
symbol_make_alias (yyvsp[-1].symbol, yyvsp[0].symbol);
}
break;
@@ -1395,7 +1395,7 @@ yyreduce:
#line 305 "parse-gram.y"
{
symbol_class_set (yyvsp[-2].symbol, current_class, yylsp[-2]);
symbol_type_set (yyvsp[-2].symbol, yylsp[-2], current_type);
symbol_type_set (yyvsp[-2].symbol, current_type, yylsp[-2]);
symbol_user_token_number_set (yyvsp[-2].symbol, yyvsp[-1].integer, yylsp[-1]);
symbol_make_alias (yyvsp[-2].symbol, yyvsp[0].symbol);
}

View File

@@ -209,7 +209,7 @@ grammar_declaration:
{
symbol_list_t *list;
for (list = $4; list; list = list->next)
symbol_destructor_set (list->sym, list->location, $3);
symbol_destructor_set (list->sym, $3, @3);
symbol_list_free ($4);
current_braced_code = action_braced_code;
}
@@ -240,7 +240,7 @@ symbol_declaration:
{
symbol_list_t *list;
for (list = $3; list; list = list->next)
symbol_type_set (list->sym, list->location, $2);
symbol_type_set (list->sym, $2, @2);
symbol_list_free ($3);
}
;
@@ -252,8 +252,8 @@ precedence_declaration:
++current_prec;
for (list = $3; list; list = list->next)
{
symbol_type_set (list->sym, list->location, current_type);
symbol_precedence_set (list->sym, list->location, current_prec, $1);
symbol_type_set (list->sym, current_type, @2);
symbol_precedence_set (list->sym, current_prec, $1, @1);
}
symbol_list_free ($3);
current_type = NULL;
@@ -287,24 +287,24 @@ symbol_def:
| ID
{
symbol_class_set ($1, current_class, @1);
symbol_type_set ($1, @1, current_type);
symbol_type_set ($1, current_type, @1);
}
| ID INT
{
symbol_class_set ($1, current_class, @1);
symbol_type_set ($1, @1, current_type);
symbol_type_set ($1, current_type, @1);
symbol_user_token_number_set ($1, $2, @2);
}
| ID string_as_id
{
symbol_class_set ($1, current_class, @1);
symbol_type_set ($1, @1, current_type);
symbol_type_set ($1, current_type, @1);
symbol_make_alias ($1, $2);
}
| ID INT string_as_id
{
symbol_class_set ($1, current_class, @1);
symbol_type_set ($1, @1, current_type);
symbol_type_set ($1, current_type, @1);
symbol_user_token_number_set ($1, $2, @2);
symbol_make_alias ($1, $3);
}

View File

@@ -105,7 +105,7 @@ symbol_tag_print (symbol_t *symbol, FILE *out)
`------------------------------------------------------------------*/
void
symbol_type_set (symbol_t *symbol, location_t location, char *type_name)
symbol_type_set (symbol_t *symbol, char *type_name, location_t location)
{
if (type_name)
{
@@ -122,7 +122,7 @@ symbol_type_set (symbol_t *symbol, location_t location, char *type_name)
`-------------------------------------------------------------------*/
void
symbol_destructor_set (symbol_t *symbol, location_t location, char *destructor)
symbol_destructor_set (symbol_t *symbol, char *destructor, location_t location)
{
if (destructor)
{
@@ -161,8 +161,8 @@ symbol_printer_set (symbol_t *symbol, char *printer, location_t location)
`------------------------------------------------------------------*/
void
symbol_precedence_set (symbol_t *symbol, location_t location,
int prec, associativity assoc)
symbol_precedence_set (symbol_t *symbol,
int prec, associativity assoc, location_t location)
{
if (assoc != undef_assoc)
{

View File

@@ -110,12 +110,12 @@ void symbol_make_alias PARAMS ((symbol_t *symbol, symbol_t *symval));
/* Set the TYPE_NAME associated to SYMBOL. Does nothing if passed 0 as
TYPE_NAME. */
void symbol_type_set PARAMS ((symbol_t *symbol, location_t location,
char *type_name));
void symbol_type_set PARAMS ((symbol_t *symbol,
char *type_name, location_t location));
/* Set the DESTRUCTOR associated to SYMBOL. */
void symbol_destructor_set PARAMS ((symbol_t *symbol, location_t location,
char *destructor));
void symbol_destructor_set PARAMS ((symbol_t *symbol,
char *destructor, location_t location));
/* Set the PRINTER associated to SYMBOL. */
void symbol_printer_set PARAMS ((symbol_t *symbol,
@@ -123,8 +123,9 @@ void symbol_printer_set PARAMS ((symbol_t *symbol,
/* Set the PRECEDENCE associated to SYMBOL. Ensures that SYMBOL is a
terminal. Does nothing if invoked with UNDEF_ASSOC as ASSOC. */
void symbol_precedence_set PARAMS ((symbol_t *symbol, location_t location,
int prec, associativity assoc));
void symbol_precedence_set PARAMS ((symbol_t *symbol,
int prec, associativity assoc,
location_t location));
/* Set the CLASS associated to SYMBOL. */
void symbol_class_set PARAMS ((symbol_t *symbol,