+/* parse what comes after %thong
+ the full syntax is
+ %thong <type> token number literal
+ the <type> or number may be omitted. The number specifies the
+ user_token_number.
+
+ Two symbols are entered in the table, one for the token symbol and
+ one for the literal. Both are given the <type>, if any, from the declaration.
+ The ->user_token_number of the first is SALIAS and the ->user_token_number
+ of the second is set to the number, if any, from the declaration.
+ The two symbols are linked via pointers in their ->alias fields.
+
+ during output_defines_table, the symbol is reported
+ thereafter, only the literal string is retained
+ it is the literal string that is output to yytname
+*/
+
+void
+parse_thong_decl ()
+{
+ register int token;
+ register struct bucket *symbol;
+ register char *typename = 0;
+ int k, usrtoknum;
+
+ translations = 1;
+ token = lex(); /* fetch typename or first token */
+ if (token == TYPENAME) {
+ k = strlen(token_buffer);
+ typename = NEW2(k + 1, char);
+ strcpy(typename, token_buffer);
+ value_components_used = 1;
+ token = lex(); /* fetch first token */
+ }
+
+ /* process first token */
+
+ if (token != IDENTIFIER)
+ {
+ warns(_("unrecognized item %s, expected an identifier"),
+ token_buffer);
+ skip_to_char('%');
+ return;
+ }
+ symval->class = STOKEN;
+ symval->type_name = typename;
+ symval->user_token_number = SALIAS;
+ symbol = symval;
+
+ token = lex(); /* get number or literal string */
+
+ if (token == NUMBER) {
+ usrtoknum = numval;
+ token = lex(); /* okay, did number, now get literal */
+ }
+ else usrtoknum = 0;
+
+ /* process literal string token */
+
+ if (token != IDENTIFIER || *symval->tag != '\"')
+ {
+ warns(_("expected string constant instead of %s"),
+ token_buffer);
+ skip_to_char('%');
+ return;
+ }
+ symval->class = STOKEN;
+ symval->type_name = typename;
+ symval->user_token_number = usrtoknum;
+
+ symval->alias = symbol;
+ symbol->alias = symval;
+
+ nsyms--; /* symbol and symval combined are only one symbol */
+}