X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/0d4b994cc2559aa7eb58b26d5fa96be241755a92..3b0b682fd6c55c0387aacbb86bc708da09ad2ae3:/src/symtab.h diff --git a/src/symtab.h b/src/symtab.h index d9ee96ef..480d6ca3 100644 --- a/src/symtab.h +++ b/src/symtab.h @@ -51,11 +51,27 @@ typedef int symbol_number; typedef struct symbol symbol; +/* Declaration status of a symbol. + + First, it is "undeclared". Then, if "undeclared" and used in a + %printer/%destructor, it is "used". If not "declared" by used in a + rule, it is "needed". Finally, if declared (via a rule for + nonterminals, or %oken), it is "declared". + + When status are checked at the end, "declared" symbols are fine, + "used" symbols trigger warnings, otherwise it's an error. +*/ + typedef enum { - needed, /**< found but not "defined". */ - used, /**< used by %printer but not declared. */ - declared, /**< defined with %type or %token. */ + /** Used in the input file for an unknown reason (error). */ + undeclared, + /** Used by %destructor/%printer but not defined (warning). */ + used, + /** Used in the gramar (rules) but not defined (error). */ + needed, + /** Defined with %type or %token (good). */ + declared, } status; /* When extending this structure, be sure to complete