mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 02:03:03 +00:00
style: fix comments and more debug trace
* src/location.c, src/symtab.h, src/symtab.c: here.
This commit is contained in:
@@ -155,7 +155,9 @@ int
|
|||||||
location_print (location loc, FILE *out)
|
location_print (location loc, FILE *out)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
if (trace_flag & trace_locations)
|
if (location_empty (loc))
|
||||||
|
res += fprintf (out, "(empty location)");
|
||||||
|
else if (trace_flag & trace_locations)
|
||||||
{
|
{
|
||||||
res += boundary_print (&loc.start, out);
|
res += boundary_print (&loc.start, out);
|
||||||
res += fprintf (out, "-");
|
res += fprintf (out, "-");
|
||||||
|
|||||||
@@ -3147,8 +3147,7 @@ char_name (char c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static void
|
||||||
void
|
|
||||||
current_lhs (symbol *sym, location loc, named_ref *ref)
|
current_lhs (symbol *sym, location loc, named_ref *ref)
|
||||||
{
|
{
|
||||||
current_lhs_symbol = sym;
|
current_lhs_symbol = sym;
|
||||||
|
|||||||
@@ -1158,8 +1158,7 @@ char_name (char c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static void
|
||||||
void
|
|
||||||
current_lhs (symbol *sym, location loc, named_ref *ref)
|
current_lhs (symbol *sym, location loc, named_ref *ref)
|
||||||
{
|
{
|
||||||
current_lhs_symbol = sym;
|
current_lhs_symbol = sym;
|
||||||
|
|||||||
20
src/symtab.c
20
src/symtab.c
@@ -243,7 +243,11 @@ semantic_type_new (uniqstr tag, const location *loc)
|
|||||||
| Print a symbol. |
|
| Print a symbol. |
|
||||||
`-----------------*/
|
`-----------------*/
|
||||||
|
|
||||||
#define SYMBOL_ATTR_PRINT(Attr) \
|
#define SYMBOL_INT_ATTR_PRINT(Attr) \
|
||||||
|
if (s->content) \
|
||||||
|
fprintf (f, " %s = %d", #Attr, s->content->Attr)
|
||||||
|
|
||||||
|
#define SYMBOL_STR_ATTR_PRINT(Attr) \
|
||||||
if (s->content && s->content->Attr) \
|
if (s->content && s->content->Attr) \
|
||||||
fprintf (f, " %s { %s }", #Attr, s->content->Attr)
|
fprintf (f, " %s { %s }", #Attr, s->content->Attr)
|
||||||
|
|
||||||
@@ -264,7 +268,11 @@ symbol_print (symbol const *s, FILE *f)
|
|||||||
: c == nterm_sym ? "nterm"
|
: c == nterm_sym ? "nterm"
|
||||||
: NULL, /* abort. */
|
: NULL, /* abort. */
|
||||||
s->tag);
|
s->tag);
|
||||||
SYMBOL_ATTR_PRINT (type_name);
|
putc (' ', f);
|
||||||
|
location_print (s->location, f);
|
||||||
|
SYMBOL_INT_ATTR_PRINT (code);
|
||||||
|
SYMBOL_INT_ATTR_PRINT (number);
|
||||||
|
SYMBOL_STR_ATTR_PRINT (type_name);
|
||||||
SYMBOL_CODE_PRINT (destructor);
|
SYMBOL_CODE_PRINT (destructor);
|
||||||
SYMBOL_CODE_PRINT (printer);
|
SYMBOL_CODE_PRINT (printer);
|
||||||
}
|
}
|
||||||
@@ -573,9 +581,9 @@ symbol_class_set (symbol *sym, symbol_class class, location loc, bool declaring)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------.
|
/*----------------------------.
|
||||||
| Set the USER_TOKEN_NUMBER associated with SYM. |
|
| Set the token code of SYM. |
|
||||||
`------------------------------------------------*/
|
`----------------------------*/
|
||||||
|
|
||||||
void
|
void
|
||||||
symbol_code_set (symbol *sym, int code, location loc)
|
symbol_code_set (symbol *sym, int code, location loc)
|
||||||
@@ -1000,7 +1008,7 @@ symbol_cmp (void const *a, void const *b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Store in *SORTED an array of pointers to the symbols contained in
|
/* Store in *SORTED an array of pointers to the symbols contained in
|
||||||
TABLE, sorted (alphabetically) by tag. */
|
TABLE, sorted by order of appearance (i.e., by location). */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
table_sort (struct hash_table *table, symbol ***sorted)
|
table_sort (struct hash_table *table, symbol ***sorted)
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ void symbol_precedence_set (symbol *sym, int prec, assoc a, location loc);
|
|||||||
void symbol_class_set (symbol *sym, symbol_class class, location loc,
|
void symbol_class_set (symbol *sym, symbol_class class, location loc,
|
||||||
bool declaring);
|
bool declaring);
|
||||||
|
|
||||||
/** Set the \c code associated with \c sym. */
|
/** Set the token \c code of \c sym, specified by the user at \c loc. */
|
||||||
void symbol_code_set (symbol *sym, int code, location loc);
|
void symbol_code_set (symbol *sym, int code, location loc);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user