static bucket *undeftoken;
-symbol_list *
+static symbol_list *
symbol_list_new (bucket *sym)
{
symbol_list *res = XMALLOC (symbol_list, 1);
}
+
+/*---------------------------------.
+| Parse a double quoted parameter. |
+`---------------------------------*/
+
+static const char *
+parse_dquoted_param (const char *from)
+{
+ struct obstack param_obstack;
+ const char *param = NULL;
+ int c;
+
+ obstack_init (¶m_obstack);
+ c = skip_white_space ();
+
+ if (c != '"')
+ {
+ complain (_("invalid %s declaration"), from);
+ ungetc (c, finput);
+ skip_to_char ('%');
+ return NULL;
+ }
+
+ for (;;)
+ {
+ if (literalchar (NULL, &c, '\"'))
+ obstack_1grow (¶m_obstack, c);
+ else
+ break;
+ }
+
+ obstack_1grow (¶m_obstack, '\0');
+ param = obstack_finish (¶m_obstack);
+
+ if (c != '"' || strlen (param) == 0)
+ {
+ complain (_("invalid %s declaration"), from);
+ if (c != '"')
+ ungetc (c, finput);
+ skip_to_char ('%');
+ return NULL;
+ }
+
+ return param;
+}
+
/*----------------------------------.
| Parse what comes after %skeleton. |
`----------------------------------*/
void
parse_skel_decl (void)
{
- /* Complete with parse_dquoted_param () on the CVS branch 1.29. */
+ skeleton = parse_dquoted_param ("%skeleton");
}
/*----------------------------------------------------------------.
case tok_stropt:
case tok_intopt:
case tok_obsolete:
- case tok_illegal:
abort ();
break;
+ case tok_illegal:
default:
complain (_("unrecognized: %s"), token_buffer);
skip_to_char ('%');
/* Make a dummy nonterminal, a gensym. */
bucket *sdummy = gensym ();
- /* Make a new rule, whose body is empty,
- before the current one, so that the action
- just read can belong to it. */
+ /* Make a new rule, whose body is empty, before the
+ current one, so that the action just read can
+ belong to it. */
nrules++;
nitems++;
p = symbol_list_new (sdummy);
+ /* Attach its lineno to that of the host rule. */
+ p->line = crule->line;
if (crule1)
crule1->next = p;
else
rule_table[ruleno].lhs = p->sym->value;
rule_table[ruleno].rhs = itemno;
rule_table[ruleno].line = p->line;
+ rule_table[ruleno].useful = TRUE;
p = p->next;
while (p && p->sym)
}
ritem[itemno] = 0;
+
+ if (trace_flag)
+ ritem_print (stderr);
}
\f
/*-------------------------------------------------------------------.