[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: More %
From: |
Akim Demaille |
Subject: |
FYI: More % |
Date: |
04 Nov 2001 17:22:39 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) |
I've been wanting these features for too long to wait for more. I
hope it won't be too hard to port to the trunk :(
Index: ChangeLog
from Akim Demaille <address@hidden>
* src/getargs.c (longopts): Support `--output'. getopt is now
able to understand that `--out' is OK: the two racing long options
are aliases.
(usage): Adjust.
* src/lex.h (tok_setopt): Remove, replaced with...
(tok_intopt, tok_stropt): these new guys.
* src/lex.c (getopt.h): Not needed.
(token_buffer, unlexed_token_buffer): Not const.
(percent_table): Promote `-' over `_' in directive names.
Active `%name-prefix', `file-prefix', and `output'.
(parse_percent_token): Accept possible arguments to directives.
Promote `-' over `_' in directive names.
* doc/bison.texinfo (Decl Summary): Split the list into
`directives for grammars' and `directives for bison'.
Sort'em.
Add description of `%name-prefix', `file-prefix', and `output'.
Promote `-' over `_' in directive names.
(Bison Options): s/%locactions/%locations/. Nice Freudian slip.
Simplify the description of `--name-prefix'.
Promote `-' over `_' in directive names.
Promote `--output' over `--output-file'.
Fix the description of `--defines'.
* tests/output.at: Exercise %file-prefix and %output.
Index: NEWS
--- NEWS Fri, 02 Nov 2001 19:28:01 +0100 akim
+++ NEWS Sun, 04 Nov 2001 17:12:32 +0100 akim
@@ -7,12 +7,20 @@
* Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
+* Fixed some typos in the documentation.
+
* %token MY_EOF 0 is supported.
Before, MY_EOF was silently renumbered as 257.
* doc/refcard.tex is updated.
+
+* %output, %file-prefix, %name-prefix.
+ New.
+
+* --output
+ New, aliasing `--output-file'.
-Changes in version 1.30:
+Changes in version 1.30, 2001-10-26:
* `--defines' and `--graph' have now an optionnal argument which is the
output file name. `-d' and `-g' do not change, they do not take any
@@ -23,7 +31,7 @@
* Portability fixes.
-Changes in version 1.29:
+Changes in version 1.29, 2001-09-07:
* The output file does not define const, as this caused problems when used
with common autoconfiguration schemes. If you still use ancient compilers
@@ -58,7 +66,7 @@
* @$
Automatic location tracking.
-Changes in version 1.28:
+Changes in version 1.28, 1999-07-06:
* Should compile better now with K&R compilers.
@@ -90,7 +98,7 @@
* Generated parsers should now work even on operating systems which do
not provide alloca().
-Changes in version 1.25:
+Changes in version 1.25, 1995-10-16:
* Errors in the input grammar are not fatal; Bison keeps reading
the grammar file, and reports all the errors found in it.
@@ -131,3 +139,7 @@
Changes in version 1.20:
Output file does not redefine const for C++.
+
+Local Variables:
+mode: outline
+End:
Index: doc/bison.texinfo
--- doc/bison.texinfo Fri, 28 Sep 2001 09:33:42 +0200 akim
+++ doc/bison.texinfo Sun, 04 Nov 2001 17:08:08 +0100 akim
@@ -3167,7 +3167,7 @@ @node Decl Summary
@cindex declaration summary
@cindex summary, Bison declaration
-Here is a summary of all Bison declarations:
+Here is a summary of the declarations used to define a grammar:
@table @code
@item %union
@@ -3202,11 +3202,43 @@ @node Decl Summary
@item %expect
Declare the expected number of shift-reduce conflicts
(@pxref{Expect Decl, ,Suppressing Conflict Warnings}).
address@hidden table
address@hidden %yacc
address@hidden %fixed_output_files
-Pretend the option @option{--yacc} was given, i.e., imitate Yacc,
-including its naming conventions. @xref{Bison Options}, for more.
address@hidden 1
address@hidden
+In order to change the behavior of @command{bison}, use the following
+directives:
+
address@hidden @code
address@hidden %debug
+Output a definition of the macro @code{YYDEBUG} into the parser file, so
+that the debugging facilities are compiled. @xref{Debugging, ,Debugging
+Your Parser}.
+
address@hidden %defines
+Write an extra output file containing macro definitions for the token
+type names defined in the grammar and the semantic value type
address@hidden, as well as a few @code{extern} variable declarations.
+
+If the parser output file is named @address@hidden then this file
+is named @address@hidden@refill
+
+This output file is essential if you wish to put the definition of
address@hidden in a separate source file, because @code{yylex} needs to
+be able to refer to token type codes and the variable
address@hidden @xref{Token Values, ,Semantic Values of address@hidden
+
address@hidden %file-prefix="@var{prefix}"
+Specify a prefix to use for all Bison output file names. The names are
+chosen as if the input file were named @address@hidden
+
address@hidden @item %header_extension
address@hidden Specify the extension of the parser header file generated when
address@hidden @code{%define} or @samp{-d} are used.
address@hidden
address@hidden For example, a grammar file named @file{foo.ypp} and containing a
address@hidden @code{%header_extension .hh} directive will produce a header file
address@hidden named @file{foo.tab.hh}
@item %locations
Generate the code processing the locations (@pxref{Action Features,
@@ -3215,11 +3247,16 @@ @node Decl Summary
grammar does not use it, using @samp{%locations} allows for more
accurate parse error messages.
address@hidden %pure_parser
-Request a pure (reentrant) parser program (@pxref{Pure Decl, ,A Pure
-(Reentrant) Parser}).
address@hidden %name-prefix="@var{prefix}"
+Rename the external symbols used in the parser so that they start with
address@hidden instead of @samp{yy}. The precise list of symbols renamed
+is @code{yyparse}, @code{yylex}, @code{yyerror}, @code{yynerrs},
address@hidden, @code{yychar} and @code{yydebug}. For example, if you
+use @samp{%name-prefix="c_"}, the names become @code{c_parse},
address@hidden, and so on. @xref{Multiple Parsers, ,Multiple Parsers in
+the Same Program}.
address@hidden %no_parser
address@hidden %no-parser
Do not include any C code in the parser file; generate tables only. The
parser file contains just @code{#define} directives and static variable
declarations.
@@ -3228,7 +3265,7 @@ @node Decl Summary
into a file named @address@hidden, in the form of a
brace-surrounded body fit for a @code{switch} statement.
address@hidden %no_lines
address@hidden %no-lines
Don't generate any @code{#line} preprocessor commands in the parser
file. Ordinarily Bison writes these commands in the parser file so that
the C compiler and debuggers will associate errors and object code with
@@ -3236,23 +3273,12 @@ @node Decl Summary
associate errors with the parser file, treating it an independent source
file in its own right.
address@hidden %debug
-Output a definition of the macro @code{YYDEBUG} into the parser file, so
-that the debugging facilities are compiled. @xref{Debugging, ,Debugging
-Your Parser}.
-
address@hidden %defines
-Write an extra output file containing macro definitions for the token
-type names defined in the grammar and the semantic value type
address@hidden, as well as a few @code{extern} variable declarations.
-
-If the parser output file is named @address@hidden then this file
-is named @address@hidden@refill
address@hidden %output="@var{filename}"
+Specify the @var{filename} for the parser file.
-This output file is essential if you wish to put the definition of
address@hidden in a separate source file, because @code{yylex} needs to
-be able to refer to token type codes and the variable
address@hidden @xref{Token Values, ,Semantic Values of address@hidden
address@hidden %pure-parser
+Request a pure (reentrant) parser program (@pxref{Pure Decl, ,A Pure
+(Reentrant) Parser}).
@c @item %source_extension
@c Specify the extension of the parser output file.
@@ -3260,29 +3286,6 @@ @node Decl Summary
@c For example, a grammar file named @file{foo.yy} and containing a
@c @code{%source_extension .cpp} directive will produce a parser file
@c named @file{foo.tab.cpp}
address@hidden
address@hidden @item %header_extension
address@hidden Specify the extension of the parser header file generated when
address@hidden @code{%define} or @samp{-d} are used.
address@hidden
address@hidden For example, a garmmar file named @file{foo.ypp} and containing a
address@hidden @code{%header_extension .hh} directive will produce a header file
address@hidden named @file{foo.tab.hh}
-
address@hidden %verbose
-Write an extra output file containing verbose descriptions of the
-parser states and what is done for each type of look-ahead token in
-that state.
-
-This file also describes all the conflicts, both those resolved by
-operator precedence and the unresolved ones.
-
-The file's name is made by removing @samp{.tab.c} or @samp{.c} from
-the parser output file name, and adding @samp{.output} address@hidden
-
-Therefore, if the input file is @file{foo.y}, then the parser file is
-called @file{foo.tab.c} by default. As a consequence, the verbose
-output file is called @address@hidden
@item %token_table
Generate an array of token names in the parser file. The name of the
@@ -3316,8 +3319,31 @@ @node Decl Summary
@item YYNSTATES
The number of parser states (@pxref{Parser States}).
@end table
+
address@hidden %verbose
+Write an extra output file containing verbose descriptions of the
+parser states and what is done for each type of look-ahead token in
+that state.
+
+This file also describes all the conflicts, both those resolved by
+operator precedence and the unresolved ones.
+
+The file's name is made by removing @samp{.tab.c} or @samp{.c} from
+the parser output file name, and adding @samp{.output} address@hidden
+
+Therefore, if the input file is @file{foo.y}, then the parser file is
+called @file{foo.tab.c} by default. As a consequence, the verbose
+output file is called @address@hidden
+
address@hidden %yacc
address@hidden %fixed-output-files
+Pretend the option @option{--yacc} was given, i.e., imitate Yacc,
+including its naming conventions. @xref{Bison Options}, for more.
@end table
+
+
+
@node Multiple Parsers
@section Multiple Parsers in the Same Program
@@ -5049,19 +5075,12 @@ @node Bison Options
Your Parser}.
@item --locations
-Pretend that @code{%locactions} was specified. @xref{Decl Summary}.
+Pretend that @code{%locations} was specified. @xref{Decl Summary}.
@item -p @var{prefix}
@itemx address@hidden
-Rename the external symbols used in the parser so that they start with
address@hidden instead of @samp{yy}. The precise list of symbols renamed
-is @code{yyparse}, @code{yylex}, @code{yyerror}, @code{yynerrs},
address@hidden, @code{yychar} and @code{yydebug}.
-
-For example, if you use @samp{-p c}, the names become @code{cparse},
address@hidden, and so on.
-
address@hidden Parsers, ,Multiple Parsers in the Same Program}.
+Pretend that @code{%name-prefix="@var{prefix}"} was specified.
address@hidden Summary}.
@item -l
@itemx --no-lines
@@ -5073,11 +5092,11 @@ @node Bison Options
@item -n
@itemx --no-parser
-Pretend that @code{%no_parser} was specified. @xref{Decl Summary}.
+Pretend that @code{%no-parser} was specified. @xref{Decl Summary}.
@item -k
@itemx --token-table
-Pretend that @code{%token_table} was specified. @xref{Decl Summary}.
+Pretend that @code{%token-table} was specified. @xref{Decl Summary}.
@end table
@noindent
@@ -5085,33 +5104,32 @@ @node Bison Options
@table @option
@item -d
-Pretend that @code{%verbose} was specified, i.e., write an extra output
address@hidden --defines
+Pretend that @code{%defines} was specified, i.e., write an extra output
file containing macro definitions for the token type names defined in
the grammar and the semantic value type @code{YYSTYPE}, as well as a few
@code{extern} variable declarations. @xref{Decl Summary}.
@item address@hidden
-The behaviour of @var{--defines} is the same than @samp{-d}. The only
-difference is that it has an optionnal argument which is the name of
-the output filename.
+Same as above, but save in the file @var{defines-file}.
@item -b @var{file-prefix}
@itemx address@hidden
-Specify a prefix to use for all Bison output file names. The names are
-chosen as if the input file were named @address@hidden
+Pretend that @code{%verbose} was specified, i.e, specify prefix to use
+for all Bison output file names. @xref{Decl Summary}.
@item -v
@itemx --verbose
Pretend that @code{%verbose} was specified, i.e, write an extra output
file containing verbose descriptions of the grammar and
-parser. @xref{Decl Summary}, for more.
+parser. @xref{Decl Summary}.
address@hidden -o @var{outfile}
address@hidden address@hidden
-Specify the name @var{outfile} for the parser file.
address@hidden -o @var{filename}
address@hidden address@hidden
+Specify the @var{filename} for the parser file.
-The other output files' names are constructed from @var{outfile}
-as described under the @samp{-v} and @samp{-d} options.
+The other output files' names are constructed from @var{filename} as
+described under the @samp{-v} and @samp{-d} options.
@item -g
Output a VCG definition of the LALR(1) grammar automaton computed by
@@ -5119,7 +5137,7 @@ @node Bison Options
be @file{foo.vcg}.
@item address@hidden
-The behaviour of @var{--graph} is the same than @samp{-g}. The only
+The behaviour of @var{--graph} is the same than @samp{-g}. The only
difference is that it has an optionnal argument which is the name of
the output graph filename.
@end table
@@ -5168,7 +5186,7 @@ @node Option Cross Key
\line{ --name-prefix \leaderfill -p}
\line{ --no-lines \leaderfill -l}
\line{ --no-parser \leaderfill -n}
-\line{ --output-file \leaderfill -o}
+\line{ --output \leaderfill -o}
\line{ --token-table \leaderfill -k}
\line{ --verbose \leaderfill -v}
\line{ --version \leaderfill -V}
@@ -5187,7 +5205,7 @@ @node Option Cross Key
address@hidden -p @var{name-prefix}
--no-lines -l
--no-parser -n
address@hidden -o @var{outfile}
address@hidden -o @var{outfile}
--token-table -k
--verbose -v
--version -V
@@ -5361,6 +5379,10 @@ @node Table of Symbols
Bison declaration to create a header file meant for the scanner.
@xref{Decl Summary}.
address@hidden %file-prefix="@var{prefix}"
+Bison declaration to set tge prefix of the output files. @xref{Decl
+Summary}.
+
@c @item %source_extension
@c Bison declaration to specify the generated parser output file extension.
@c @xref{Decl Summary}.
@@ -5373,7 +5395,10 @@ @node Table of Symbols
Bison declaration to assign left associativity to token(s).
@xref{Precedence Decl, ,Operator Precedence}.
address@hidden %no_lines
address@hidden %name-prefix="@var{prefix}"
+Bison declaration to rename the external symbols. @xref{Decl Summary}.
+
address@hidden %no-lines
Bison declaration to avoid generating @code{#line} directives in the
parser file. @xref{Decl Summary}.
@@ -5381,11 +5406,15 @@ @node Table of Symbols
Bison declaration to assign non-associativity to token(s).
@xref{Precedence Decl, ,Operator Precedence}.
address@hidden %output="@var{filename}"
+Bison declaration to set the name of the parser file. @xref{Decl
+Summary}.
+
@item %prec
Bison declaration to assign a precedence to a specific rule.
@xref{Contextual Precedence, ,Context-Dependent Precedence}.
address@hidden %pure_parser
address@hidden %pure-parser
Bison declaration to request a pure (reentrant) parser.
@xref{Pure Decl, ,A Pure (Reentrant) Parser}.
@@ -5400,7 +5429,7 @@ @node Table of Symbols
Bison declaration to declare token(s) without specifying precedence.
@xref{Token Decl, ,Token Type Names}.
address@hidden %token_table
address@hidden %token-table
Bison declaration to include a token name table in the parser file.
@xref{Decl Summary}.
Index: src/getargs.c
--- src/getargs.c Thu, 11 Oct 2001 19:02:23 +0200 akim
+++ src/getargs.c Sun, 04 Nov 2001 15:10:02 +0100 akim
@@ -63,6 +63,7 @@
{"defines", optional_argument, 0, 'd'},
{"verbose", no_argument, 0, 'v'},
{"file-prefix", required_argument, 0, 'b'},
+ {"output", required_argument, 0, 'o'},
{"output-file", required_argument, 0, 'o'},
{"graph", optional_argument, 0, 'g'},
@@ -118,9 +119,9 @@ Output:\n\
-d, --defines also produce a header file\n\
-v, --verbose also produce an explanation of the automaton\n\
-b, --file-prefix=PREFIX specify a PREFIX for output files\n\
- -o, --output-file=FILE leave output to FILE\n\
- -g, --graph also produce a VCG graph description of the \
-automaton\n"), stream);
+ -o, --output=FILE leave output to FILE\n\
+ -g, --graph also produce a VCG description of the automaton\n\
+"), stream);
putc ('\n', stream);
fputs (_("\
Index: src/lex.c
--- src/lex.c Fri, 02 Nov 2001 19:28:01 +0100 akim
+++ src/lex.c Sun, 04 Nov 2001 17:16:39 +0100 akim
@@ -21,7 +21,6 @@
#include "system.h"
#include "getargs.h"
#include "files.h"
-#include "getopt.h" /* for optarg */
#include "symtab.h"
#include "lex.h"
#include "complain.h"
@@ -30,7 +29,7 @@
/* Buffer for storing the current token. */
struct obstack token_obstack;
-const char *token_buffer = NULL;
+char *token_buffer = NULL;
bucket *symval;
int numval;
@@ -38,7 +37,7 @@
/* A token to be reread, see unlex and lex. */
static token_t unlexed = tok_undef;
static bucket *unlexed_symval = NULL;
-static const char *unlexed_token_buffer = NULL;
+static char *unlexed_token_buffer = NULL;
void
lex_init (void)
@@ -427,7 +426,7 @@
/* parse the literal token and compute character code in code */
{
- int code, discode;
+ int code;
obstack_1grow (&token_obstack, '\'');
literalchar (&token_obstack, &code, '\'');
@@ -435,6 +434,7 @@
c = getc (finput);
if (c != '\'')
{
+ int discode;
complain (_("use \"...\" for multi-character literal tokens"));
while (1)
if (!literalchar (0, &discode, '\''))
@@ -553,28 +553,27 @@
{ "nonassoc", NULL, tok_nonassoc },
{ "binary", NULL, tok_nonassoc },
{ "prec", NULL, tok_prec },
- { "locations", &locations_flag, tok_noop }, /* -l */
- { "no_lines", &no_lines_flag, tok_noop }, /* -l */
+ { "locations", &locations_flag, tok_intopt }, /* -l */
+ { "no-lines", &no_lines_flag, tok_intopt }, /* -l */
{ "raw", NULL, tok_obsolete }, /* -r */
- { "token_table", &token_table_flag, tok_noop }, /* -k */
- { "yacc", &yacc_flag, tok_noop }, /* -y */
- { "fixed_output_files",&yacc_flag, tok_noop }, /* -y */
- { "defines", &defines_flag, tok_noop }, /* -d */
- { "no_parser", &no_parser_flag, tok_noop }, /* -n */
- { "graph", &graph_flag, tok_noop }, /* -g */
-#if 0
- /* For the time being, this is not enabled yet, while it's possible
- though, since we use obstacks. The only risk is with semantic
- parsers which will output an `include' of an output file: be sure
- that the name included is indeed the name of the output file. */
- { "output_file", &spec_outfile, tok_setopt }, /* -o */
- { "file_prefix", &spec_file_prefix, tok_setopt }, /* -b */
- { "name_prefix", &spec_name_prefix, tok_setopt }, /* -p */
-#endif
- { "verbose", &verbose_flag, tok_noop }, /* -v */
- { "debug", &debug_flag, tok_noop }, /* -t */
- { "semantic_parser", &semantic_parser, tok_noop },
- { "pure_parser", &pure_parser, tok_noop },
+ { "token-table", &token_table_flag, tok_intopt }, /* -k */
+ { "yacc", &yacc_flag, tok_intopt }, /* -y */
+ { "fixed-output-files",&yacc_flag, tok_intopt }, /* -y */
+ { "defines", &defines_flag, tok_intopt }, /* -d */
+ { "no-parser", &no_parser_flag, tok_intopt }, /* -n */
+ { "graph", &graph_flag, tok_intopt }, /* -g */
+
+ /* FIXME: semantic parsers which will output an `include' of an
+ output file: be sure that the name included is indeed the name of
+ the output file. */
+ { "output", &spec_outfile, tok_stropt }, /* -o */
+ { "file-prefix", &spec_file_prefix, tok_stropt }, /* -b */
+ { "name-prefix", &spec_name_prefix, tok_stropt }, /* -p */
+
+ { "verbose", &verbose_flag, tok_intopt }, /* -v */
+ { "debug", &debug_flag, tok_intopt }, /* -t */
+ { "semantic-parser", &semantic_parser, tok_intopt },
+ { "pure-parser", &pure_parser, tok_intopt },
{ NULL, NULL, tok_illegal}
};
@@ -585,7 +584,10 @@
token_t
parse_percent_token (void)
{
- struct percent_table_struct *tx;
+ struct percent_table_struct *tx = NULL;
+ /* Where `=' was found in token_buffer. */
+ size_t equal_offset = 0;
+ char *arg = NULL;
int c = getc (finput);
@@ -597,6 +599,8 @@
case '{':
return tok_percent_left_curly;
+ /* FIXME: Who the heck are those 5 guys!?! `%<' = `%left'!!!
+ Let's ask for there removal. */
case '<':
return tok_left;
@@ -619,42 +623,80 @@
obstack_1grow (&token_obstack, '%');
while (isalpha (c) || c == '_' || c == '-')
{
- if (c == '-')
- c = '_';
+ if (c == '_')
+ c = '-';
obstack_1grow (&token_obstack, c);
c = getc (finput);
}
- ungetc (c, finput);
+ if (c == '=')
+ {
+ equal_offset = obstack_object_size (&token_obstack);
+ obstack_1grow (&token_obstack, c);
+ c = getc (finput);
+ if (c = '"')
+ {
+ int code; /* ignored here */
+
+ obstack_1grow (&token_obstack, '"');
+ /* Read up to and including ". */
+ while (literalchar (&token_obstack, &code, '"'))
+ /* nothing */;
+ }
+ }
+ else
+ ungetc (c, finput);
+
obstack_1grow (&token_obstack, '\0');
token_buffer = obstack_finish (&token_obstack);
+ if (equal_offset)
+ {
+ /* %token_buffer="arg" */
+ arg = token_buffer + equal_offset + 2;
+ arg[strlen (arg) - 1] = '\0';
+ token_buffer[equal_offset] = '\0';
+ }
/* table lookup % directive */
for (tx = percent_table; tx->name; tx++)
if (strcmp (token_buffer + 1, tx->name) == 0)
break;
- if (tx->set_flag)
- {
- *((int *) (tx->set_flag)) = 1;
- return tok_noop;
- }
+ if (arg && !tx->retval == tok_stropt)
+ fatal (_("`%s' supports no argument: %s"), token_buffer, quotearg (arg));
switch (tx->retval)
{
- case tok_setopt:
- *((char **) (tx->set_flag)) = optarg;
+ case tok_stropt:
+ assert (tx->set_flag);
+ if (arg)
+ {
+ /* Keep only the first assignment: command line options have
+ already been processed, and we want them to have
+ precedence. Side effect: if this %-option is used
+ several times, only the first is honored. Bah. */
+ if (!*((char **) (tx->set_flag)))
+ *((char **) (tx->set_flag)) = arg;
+ }
+ else
+ fatal (_("`%s' requires an argument"), token_buffer);
+ return tok_noop;
+ break;
+
+ case tok_intopt:
+ assert (tx->set_flag);
+ *((int *) (tx->set_flag)) = 1;
return tok_noop;
break;
case tok_obsolete:
fatal (_("`%s' is no longer supported"), token_buffer);
+ return tok_noop;
break;
default:
- /* Other cases do not apply here. */
+ return tx->retval;
break;
}
-
- return tx->retval;
+ abort ();
}
Index: src/lex.h
--- src/lex.h Thu, 11 Oct 2001 19:02:23 +0200 akim
+++ src/lex.h Sun, 04 Nov 2001 16:12:39 +0100 akim
@@ -49,12 +49,13 @@
tok_expect,
tok_thong,
tok_noop,
- tok_setopt,
+ tok_intopt,
+ tok_stropt,
tok_illegal,
tok_obsolete
} token_t;
-extern const char *token_buffer;
+extern char *token_buffer;
extern bucket *symval;
extern int numval;
Index: src/reader.c
--- src/reader.c Fri, 02 Nov 2001 19:28:01 +0100 akim
+++ src/reader.c Sun, 04 Nov 2001 16:21:13 +0100 akim
@@ -936,16 +936,13 @@
static void
read_declarations (void)
{
- int c;
- int tok;
-
for (;;)
{
- c = skip_white_space ();
+ int c = skip_white_space ();
if (c == '%')
{
- tok = parse_percent_token ();
+ token_t tok = parse_percent_token ();
switch (tok)
{
@@ -997,6 +994,13 @@
break;
case tok_noop:
+ break;
+
+ case tok_stropt:
+ case tok_intopt:
+ case tok_obsolete:
+ case tok_illegal:
+ abort ();
break;
default:
Index: tests/output.at
--- tests/output.at Fri, 28 Sep 2001 09:33:42 +0200 akim
+++ tests/output.at Sun, 04 Nov 2001 17:04:49 +0100 akim
@@ -53,6 +53,16 @@ foo: {}
AT_CHECK_OUTPUT([foo.y], [%defines %verbose %yacc],[],
[y.output y.tab.c y.tab.h])
+# Exercise %output and %file-prefix
+AT_CHECK_OUTPUT([foo.y], [%file-prefix="bar" %defines %verbose], [],
+ [bar.output bar.tab.c bar.tab.h])
+AT_CHECK_OUTPUT([foo.y], [%output="bar.c" %defines %verbose %yacc],[],
+ [bar.output bar.c bar.h])
+AT_CHECK_OUTPUT([foo.y],
+ [%file-prefix="baz" %output="bar.c" %defines %verbose %yacc],
+ [],
+ [bar.output bar.c bar.h])
+
# Check priorities of extension control.
AT_CHECK_OUTPUT([foo.yy], [%defines %verbose], [],
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: More %,
Akim Demaille <=