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