Le 31 juil. 2013 à 10:22, Akim Demaille <[email protected]> a écrit :
> > Le 30 juil. 2013 à 18:41, Valentin Tolmer <[email protected]> a écrit : > >>> >>> Don't you think that these guys should still work on symbols >>> as before, but process their content behind the scenes? >>> >>> I think that these changes should be mostly internal, and >>> virtualy invisible from the call sites. >>> >> I thought so, too, but apart from somewhat simplifying the code, it seemed >> to make more sense to call the function on the content, as this is what we >> want to modify. > > I think that the caller does not need to know what she > is modifying. She basically wants to change information > about the symbols, and how symbols are implemented is not > her business. Unfortunately, because we don't provide > accessors, eventually the implementation shows, when reading > these fields; but in C++ for instance, we would have hidden > this. > >> But if you think it's better to make the changes transparent, I understand, >> and will revert. > > I think it is better to hide this, yes. I'm about to push your patch in {master}, with the following changes. Don't publish in NEWS what _users_ can't see; NEWS is not for the developers (git log is :). diff --git a/NEWS b/NEWS index 67f4633..3e783ee 100644 --- a/NEWS +++ b/NEWS @@ -2,16 +2,6 @@ GNU Bison NEWS * Noteworthy changes in release ?.? (????-??-??) [?] -** Alias improvement - - Aliases were formerly handled this way: information about the symbol was - repeated in the symbol and the alias, and any discrepancy was resolved - after reading the whole grammar. - - Now, however, the symbol and the alias share a pointer to a separate - structure containing the common information, and any incompatible - statement is thus detected at the moment it is read. - * Noteworthy changes in release 3.0 (2013-07-25) [stable] ** WARNING: Future backward-incompatibilities! diff --git a/src/print.c b/src/print.c index 94d3d2d..f8ed3da 100644 --- a/src/print.c +++ b/src/print.c @@ -258,7 +258,7 @@ print_reductions (FILE *out, state *s) bitset_set (no_reduce_set, TRANSITION_SYMBOL (trans, i)); for (i = 0; i < s->errs->num; ++i) if (s->errs->symbols[i]) - bitset_set (no_reduce_set, s->errs->symbols[i]->content->number); + bitset_set (no_reduce_set, s->errs->symbols[i]->content->number); /* Compute the width of the lookahead token column. */ if (default_reduction) diff --git a/src/reduce.c b/src/reduce.c index 23ab7e4..e79d205 100644 --- a/src/reduce.c +++ b/src/reduce.c @@ -196,9 +196,9 @@ inaccessable_symbols (void) V = Vp; /* Tokens 0, 1, and 2 are internal to Bison. Consider them useful. */ - bitset_set (V, endtoken->content->number); /* end-of-input token */ - bitset_set (V, errtoken->content->number); /* error token */ - bitset_set (V, undeftoken->content->number); /* some undefined token */ + bitset_set (V, endtoken->content->number); /* end-of-input token */ + bitset_set (V, errtoken->content->number); /* error token */ + bitset_set (V, undeftoken->content->number); /* some undefined token */ bitset_free (P); P = Pp; Also, I have changed your commit message to use a better author, and a style which is consistent with the remainder of our commits. commit a7280757105b2909f6a58fdd1c582de8e278319a Author: Valentin Tolmer <[email protected]> Date: Wed Jul 31 11:51:59 2013 +0200 symbols: improve symbol aliasing Rather than having duplicate info in the symbol and the alias that has to be resolved later on, both the symbol and the alias have a common pointer to a separate structure containing this info. * src/symtab.h (sym_content): New structure. * src/symtab.c (sym_content_new, sym_content_free, symbol_free): New * src/AnnotationList.c, src/conflicts.c, src/gram.c, src/gram.h, * src/graphviz.c, src/ielr.c, src/output.c, src/parse-gram.y, src/print.c * src/print-xml.c, src/print_graph.c, src/reader.c, src/reduce.c, * src/state.h, src/symlist.c, src/symtab.c, src/symtab.h, src/tables.c: Adjust. * tests/input.at: Fix expectations (order changes).
