- int c;
- int count;
- int brace_flag = 0;
-
- /* offset is always 0 if parser has already popped the stack pointer */
- if (semantic_parser)
- stack_offset = 0;
-
- obstack_fgrow1 (&guard_obstack, "\ncase %d:\n", nrules);
- if (!no_lines_flag)
- obstack_fgrow2 (&guard_obstack, "#line %d %s\n",
- lineno, quotearg_style (c_quoting_style, infile));
- obstack_1grow (&guard_obstack, '{');
-
- count = 0;
- c = getc (finput);
-
- while (brace_flag ? (count > 0) : (c != ';'))
- {
- switch (c)
- {
- case '\n':
- obstack_1grow (&guard_obstack, c);
- lineno++;
- break;
-
- case '{':
- obstack_1grow (&guard_obstack, c);
- brace_flag = 1;
- count++;
- break;
-
- case '}':
- obstack_1grow (&guard_obstack, c);
- if (count > 0)
- count--;
- else
- {
- complain (_("unmatched %s"), "`}'");
- c = getc (finput); /* skip it */
- }
- break;
-
- case '\'':
- case '"':
- copy_string (finput, &guard_obstack, c);
- break;
-
- case '/':
- copy_comment (finput, &guard_obstack);
- break;
-
- case '$':
- copy_dollar (finput, &guard_obstack, rule, stack_offset);
- break;
-
- case '@':
- copy_at (finput, &guard_obstack, stack_offset);
- break;
-
- case EOF:
- fatal ("%s", _("unterminated %guard clause"));
-
- default:
- obstack_1grow (&guard_obstack, c);
- }
-
- if (c != '}' || count != 0)
- c = getc (finput);
- }
-
- c = skip_white_space ();
-
- obstack_sgrow (&guard_obstack, ";\n break;}");
- if (c == '{')
- copy_action (rule, stack_offset);
- else if (c == '=')
- {
- c = getc (finput); /* why not skip_white_space -wjh */
- if (c == '{')
- copy_action (rule, stack_offset);
- }
- else
- ungetc (c, finput);