style: comment changes

* src/symtab.h, src/lr0.c: here.
This commit is contained in:
Akim Demaille
2020-02-22 20:25:12 +01:00
parent 323731ff74
commit 296660304c
4 changed files with 16 additions and 15 deletions

View File

@@ -42,9 +42,9 @@
Internally, we cannot use the number 0 for a rule because for Internally, we cannot use the number 0 for a rule because for
instance RITEM stores both symbol (the RHS) and rule numbers: the instance RITEM stores both symbol (the RHS) and rule numbers: the
symbols are shorts >= 0, and rule number are stored negative. symbols are integers >= 0, and rule numbers are stored negative.
Therefore 0 cannot be used, since it would be both the rule number Therefore 0 cannot be used, since it would be both the rule number
0, and the token $end). 0, and the token $end.
Actions are accessed via the rule number. Actions are accessed via the rule number.
@@ -55,8 +55,7 @@
RULES[R].lhs -- the symbol of the left hand side of rule R. RULES[R].lhs -- the symbol of the left hand side of rule R.
RULES[R].rhs -- the index in RITEM of the beginning of the portion RULES[R].rhs -- the beginning of the portion of RITEM for rule R.
for rule R.
RULES[R].prec -- the symbol providing the precedence level of R. RULES[R].prec -- the symbol providing the precedence level of R.
@@ -75,16 +74,16 @@
RULES[R].line -- the line where R was defined. RULES[R].line -- the line where R was defined.
RULES[R].useful -- whether the rule is used (i.e., false if thrown RULES[R].useful -- whether the rule is used. False if thrown away
away by reduce). by reduce().
The right hand side is stored as symbol numbers in a portion of The right hand side is stored as symbol numbers in a portion of
RITEM. RITEM.
The length of the portion is one greater than the number of symbols The length of the portion is one greater than the number of symbols
in the rule's right hand side. The last element in the portion in the rule's right hand side. The last element in the portion
contains minus R, which identifies it as the end of a portion and contains -R, which identifies it as the end of a portion and says
says which rule it is for. which rule it is for.
The portions of RITEM come in order of increasing rule number. The portions of RITEM come in order of increasing rule number.
NRITEMS is the total length of RITEM. Each element of RITEM is NRITEMS is the total length of RITEM. Each element of RITEM is

View File

@@ -58,10 +58,11 @@ core_print (size_t core_size, item_number *core, FILE *out)
} }
} }
/*------------------------------------------------------------------. /*-----------------------------------------------------------------.
| A state was just discovered from another state. Queue it for | | A state was just discovered by transitioning on SYM from another |
| later examination, in order to find its transitions. Return it. | | state. Queue this state for later examination, in order to find |
`------------------------------------------------------------------*/ | its outgoing transitions. Return it. |
`-----------------------------------------------------------------*/
static state * static state *
state_list_append (symbol_number sym, size_t core_size, item_number *core) state_list_append (symbol_number sym, size_t core_size, item_number *core)
@@ -98,7 +99,7 @@ static state **shiftset;
/* KERNEL_BASE[symbol-number] -> list of item numbers (offsets inside /* KERNEL_BASE[symbol-number] -> list of item numbers (offsets inside
RITEM) of lenngth KERNEL_SIZE[symbol-number]. */ RITEM) of length KERNEL_SIZE[symbol-number]. */
static item_number **kernel_base; static item_number **kernel_base;
static int *kernel_size; static int *kernel_size;

View File

@@ -607,7 +607,7 @@ packgram (void)
{ {
int itemno = 0; int itemno = 0;
ritem = xnmalloc (nritems + 1, sizeof *ritem); ritem = xnmalloc (nritems + 1, sizeof *ritem);
/* This sentinel is used by build_relations in gram.c. */ /* This sentinel is used by build_relations() in lalr.c. */
*ritem++ = 0; *ritem++ = 0;
rule_number ruleno = 0; rule_number ruleno = 0;

View File

@@ -230,7 +230,8 @@ void symbol_precedence_set (symbol *sym, int prec, assoc a, location loc);
/** Set the \c class associated with \c sym. /** Set the \c class associated with \c sym.
Whether \c declaring means whether this class definition comes Whether \c declaring means whether this class definition comes
from %nterm or %token (but not %type, prec/assoc, etc.). */ from %nterm or %token (but not %type, prec/assoc, etc.). A symbol
can have "declaring" set only at most once. */
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);