mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-22 18:53:04 +00:00
Support a file name argument to %defines. Deprecate `=' in
%file-prefix, %name-prefix, and %output. Discussed at <http://lists.gnu.org/archive/html/help-bison/2006-09/msg00001.html>. * NEWS (2.3a+): Mention. * doc/bison.texinfo (Decl Summary, Bison Symbols): Add entry for new form of %defines, and remove `=' from entries for %file-prefix, %name-prefix, and %output. * src/parse-gram.y (prologue_declaration): Implement. * tests/calc.at (Simple LALR Calculator, Simple GLR Calculator, Simple LALR1 C++ Calculator, Simple GLR C++ Calculator): Remove the `=' from all but one occurrence of %name-prefix. * tests/headers.at (export YYLTYPE): Remove the `=' from %name-prefix. * tests/local.at (_AT_BISON_OPTION_PUSHDEFS): Likewise. * tests/output.at (AT_CHECK_OUTPUT): Remove the `=' from all but one occurrence of each of %file-prefix and %output. Add check for %defines with argument. * tests/reduce.at (Useless Terminals, Useless Nonterminals, Useless Rules, Reduced Automaton, Underivable Rules, Empty Language): Remove the `=' from %output.
This commit is contained in:
22
ChangeLog
22
ChangeLog
@@ -1,3 +1,25 @@
|
|||||||
|
2006-12-01 Joel E. Denny <jdenny@ces.clemson.edu>
|
||||||
|
|
||||||
|
Support a file name argument to %defines. Deprecate `=' in
|
||||||
|
%file-prefix, %name-prefix, and %output. Discussed at
|
||||||
|
<http://lists.gnu.org/archive/html/help-bison/2006-09/msg00001.html>.
|
||||||
|
* NEWS (2.3a+): Mention.
|
||||||
|
* doc/bison.texinfo (Decl Summary, Bison Symbols): Add entry for new
|
||||||
|
form of %defines, and remove `=' from entries for %file-prefix,
|
||||||
|
%name-prefix, and %output.
|
||||||
|
* src/parse-gram.y (prologue_declaration): Implement.
|
||||||
|
* tests/calc.at (Simple LALR Calculator, Simple GLR Calculator, Simple
|
||||||
|
LALR1 C++ Calculator, Simple GLR C++ Calculator): Remove the `=' from
|
||||||
|
all but one occurrence of %name-prefix.
|
||||||
|
* tests/headers.at (export YYLTYPE): Remove the `=' from %name-prefix.
|
||||||
|
* tests/local.at (_AT_BISON_OPTION_PUSHDEFS): Likewise.
|
||||||
|
* tests/output.at (AT_CHECK_OUTPUT): Remove the `=' from all but one
|
||||||
|
occurrence of each of %file-prefix and %output. Add check for %defines
|
||||||
|
with argument.
|
||||||
|
* tests/reduce.at (Useless Terminals, Useless Nonterminals,
|
||||||
|
Useless Rules, Reduced Automaton, Underivable Rules, Empty Language):
|
||||||
|
Remove the `=' from %output.
|
||||||
|
|
||||||
2006-11-21 Joel E. Denny <jdenny@ces.clemson.edu>
|
2006-11-21 Joel E. Denny <jdenny@ces.clemson.edu>
|
||||||
|
|
||||||
Don't escape $ in test case titles since Autoconf 2.61 now does that
|
Don't escape $ in test case titles since Autoconf 2.61 now does that
|
||||||
|
|||||||
12
NEWS
12
NEWS
@@ -6,6 +6,18 @@ Changes in version 2.3a+ (????-??-??):
|
|||||||
* The -g and --graph options now output graphs in Graphviz DOT format,
|
* The -g and --graph options now output graphs in Graphviz DOT format,
|
||||||
not VCG format.
|
not VCG format.
|
||||||
|
|
||||||
|
* The grammar file may now specify the name of the parser header file using
|
||||||
|
%defines. For example:
|
||||||
|
|
||||||
|
%defines "parser.h"
|
||||||
|
|
||||||
|
* The `=' that used to be required in the following declarations is now
|
||||||
|
deprecated:
|
||||||
|
|
||||||
|
%file-prefix "parser"
|
||||||
|
%name-prefix "c_"
|
||||||
|
%output "parser.c"
|
||||||
|
|
||||||
* Revised warning: unset or unused mid-rule values
|
* Revised warning: unset or unused mid-rule values
|
||||||
|
|
||||||
Since Bison 2.2, Bison has warned about mid-rule values that are set but not
|
Since Bison 2.2, Bison has warned about mid-rule values that are set but not
|
||||||
|
|||||||
@@ -4598,12 +4598,16 @@ header also contains their code.
|
|||||||
@xref{Table of Symbols, ,%requires}.
|
@xref{Table of Symbols, ,%requires}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@deffn {Directive} %defines @var{defines-file}
|
||||||
|
Same as above, but save in the file @var{defines-file}.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} %destructor
|
@deffn {Directive} %destructor
|
||||||
Specify how the parser should reclaim the memory associated to
|
Specify how the parser should reclaim the memory associated to
|
||||||
discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}.
|
discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} %file-prefix="@var{prefix}"
|
@deffn {Directive} %file-prefix "@var{prefix}"
|
||||||
Specify a prefix to use for all Bison output file names. The names are
|
Specify a prefix to use for all Bison output file names. The names are
|
||||||
chosen as if the input file were named @file{@var{prefix}.y}.
|
chosen as if the input file were named @file{@var{prefix}.y}.
|
||||||
@end deffn
|
@end deffn
|
||||||
@@ -4616,14 +4620,14 @@ grammar does not use it, using @samp{%locations} allows for more
|
|||||||
accurate syntax error messages.
|
accurate syntax error messages.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} %name-prefix="@var{prefix}"
|
@deffn {Directive} %name-prefix "@var{prefix}"
|
||||||
Rename the external symbols used in the parser so that they start with
|
Rename the external symbols used in the parser so that they start with
|
||||||
@var{prefix} instead of @samp{yy}. The precise list of symbols renamed
|
@var{prefix} instead of @samp{yy}. The precise list of symbols renamed
|
||||||
in C parsers
|
in C parsers
|
||||||
is @code{yyparse}, @code{yylex}, @code{yyerror}, @code{yynerrs},
|
is @code{yyparse}, @code{yylex}, @code{yyerror}, @code{yynerrs},
|
||||||
@code{yylval}, @code{yychar}, @code{yydebug}, and
|
@code{yylval}, @code{yychar}, @code{yydebug}, and
|
||||||
(if locations are used) @code{yylloc}. For example, if you use
|
(if locations are used) @code{yylloc}. For example, if you use
|
||||||
@samp{%name-prefix="c_"}, the names become @code{c_parse}, @code{c_lex},
|
@samp{%name-prefix "c_"}, the names become @code{c_parse}, @code{c_lex},
|
||||||
and so on. In C++ parsers, it is only the surrounding namespace which is
|
and so on. In C++ parsers, it is only the surrounding namespace which is
|
||||||
named @var{prefix} instead of @samp{yy}.
|
named @var{prefix} instead of @samp{yy}.
|
||||||
@xref{Multiple Parsers, ,Multiple Parsers in the Same Program}.
|
@xref{Multiple Parsers, ,Multiple Parsers in the Same Program}.
|
||||||
@@ -4656,7 +4660,7 @@ associate errors with the parser file, treating it an independent source
|
|||||||
file in its own right.
|
file in its own right.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} %output="@var{file}"
|
@deffn {Directive} %output "@var{file}"
|
||||||
Specify @var{file} for the parser file.
|
Specify @var{file} for the parser file.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@@ -7265,7 +7269,7 @@ Pretend that @code{%locations} was specified. @xref{Decl Summary}.
|
|||||||
|
|
||||||
@item -p @var{prefix}
|
@item -p @var{prefix}
|
||||||
@itemx --name-prefix=@var{prefix}
|
@itemx --name-prefix=@var{prefix}
|
||||||
Pretend that @code{%name-prefix="@var{prefix}"} was specified.
|
Pretend that @code{%name-prefix "@var{prefix}"} was specified.
|
||||||
@xref{Decl Summary}.
|
@xref{Decl Summary}.
|
||||||
|
|
||||||
@item -l
|
@item -l
|
||||||
@@ -8653,6 +8657,11 @@ Bison declaration to create a header file meant for the scanner.
|
|||||||
@xref{Decl Summary}.
|
@xref{Decl Summary}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@deffn {Directive} %defines @var{defines-file}
|
||||||
|
Same as above, but save in the file @var{defines-file}.
|
||||||
|
@xref{Decl Summary}.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} %destructor
|
@deffn {Directive} %destructor
|
||||||
Specify how the parser should reclaim the memory associated to
|
Specify how the parser should reclaim the memory associated to
|
||||||
discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}.
|
discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}.
|
||||||
@@ -8685,7 +8694,7 @@ Bison declaration to request verbose, specific error message strings
|
|||||||
when @code{yyerror} is called.
|
when @code{yyerror} is called.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} %file-prefix="@var{prefix}"
|
@deffn {Directive} %file-prefix "@var{prefix}"
|
||||||
Bison declaration to set the prefix of the output files. @xref{Decl
|
Bison declaration to set the prefix of the output files. @xref{Decl
|
||||||
Summary}.
|
Summary}.
|
||||||
@end deffn
|
@end deffn
|
||||||
@@ -8717,7 +8726,7 @@ function is applied to the two semantic values to get a single result.
|
|||||||
@xref{GLR Parsers, ,Writing @acronym{GLR} Parsers}.
|
@xref{GLR Parsers, ,Writing @acronym{GLR} Parsers}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} %name-prefix="@var{prefix}"
|
@deffn {Directive} %name-prefix "@var{prefix}"
|
||||||
Bison declaration to rename the external symbols. @xref{Decl Summary}.
|
Bison declaration to rename the external symbols. @xref{Decl Summary}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@@ -8739,7 +8748,7 @@ Bison declaration to assign nonassociativity to token(s).
|
|||||||
@xref{Precedence Decl, ,Operator Precedence}.
|
@xref{Precedence Decl, ,Operator Precedence}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} %output="@var{file}"
|
@deffn {Directive} %output "@var{file}"
|
||||||
Bison declaration to set the name of the parser file. @xref{Decl
|
Bison declaration to set the name of the parser file. @xref{Decl
|
||||||
Summary}.
|
Summary}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|||||||
839
src/parse-gram.c
839
src/parse-gram.c
File diff suppressed because it is too large
Load Diff
@@ -226,10 +226,16 @@ prologue_declaration:
|
|||||||
| "%debug" { debug_flag = true; }
|
| "%debug" { debug_flag = true; }
|
||||||
| "%define" STRING content.opt { muscle_insert ($2, $3); }
|
| "%define" STRING content.opt { muscle_insert ($2, $3); }
|
||||||
| "%defines" { defines_flag = true; }
|
| "%defines" { defines_flag = true; }
|
||||||
|
| "%defines" STRING
|
||||||
|
{
|
||||||
|
defines_flag = true;
|
||||||
|
spec_defines_file = xstrdup ($2);
|
||||||
|
}
|
||||||
| "%error-verbose" { error_verbose = true; }
|
| "%error-verbose" { error_verbose = true; }
|
||||||
| "%expect" INT { expected_sr_conflicts = $2; }
|
| "%expect" INT { expected_sr_conflicts = $2; }
|
||||||
| "%expect-rr" INT { expected_rr_conflicts = $2; }
|
| "%expect-rr" INT { expected_rr_conflicts = $2; }
|
||||||
| "%file-prefix" "=" STRING { spec_file_prefix = $3; }
|
| "%file-prefix" STRING { spec_file_prefix = $2; }
|
||||||
|
| "%file-prefix" "=" STRING { spec_file_prefix = $3; } /* deprecated */
|
||||||
| "%glr-parser"
|
| "%glr-parser"
|
||||||
{
|
{
|
||||||
nondeterministic_parser = true;
|
nondeterministic_parser = true;
|
||||||
@@ -241,10 +247,12 @@ prologue_declaration:
|
|||||||
}
|
}
|
||||||
| "%lex-param" "{...}" { add_param ("lex_param", $2, @2); }
|
| "%lex-param" "{...}" { add_param ("lex_param", $2, @2); }
|
||||||
| "%locations" { locations_flag = true; }
|
| "%locations" { locations_flag = true; }
|
||||||
| "%name-prefix" "=" STRING { spec_name_prefix = $3; }
|
| "%name-prefix" STRING { spec_name_prefix = $2; }
|
||||||
|
| "%name-prefix" "=" STRING { spec_name_prefix = $3; } /* deprecated */
|
||||||
| "%no-lines" { no_lines_flag = true; }
|
| "%no-lines" { no_lines_flag = true; }
|
||||||
| "%nondeterministic-parser" { nondeterministic_parser = true; }
|
| "%nondeterministic-parser" { nondeterministic_parser = true; }
|
||||||
| "%output" "=" STRING { spec_outfile = $3; }
|
| "%output" STRING { spec_outfile = $2; }
|
||||||
|
| "%output" "=" STRING { spec_outfile = $3; } /* deprecated */
|
||||||
| "%parse-param" "{...}" { add_param ("parse_param", $2, @2); }
|
| "%parse-param" "{...}" { add_param ("parse_param", $2, @2); }
|
||||||
| "%pure-parser" { pure_parser = true; }
|
| "%pure-parser" { pure_parser = true; }
|
||||||
| "%push-parser" { push_parser = true; }
|
| "%push-parser" { push_parser = true; }
|
||||||
|
|||||||
@@ -556,7 +556,7 @@ AT_CHECK_CALC_LALR()
|
|||||||
|
|
||||||
AT_CHECK_CALC_LALR([%defines])
|
AT_CHECK_CALC_LALR([%defines])
|
||||||
AT_CHECK_CALC_LALR([%locations])
|
AT_CHECK_CALC_LALR([%locations])
|
||||||
AT_CHECK_CALC_LALR([%name-prefix="calc"])
|
AT_CHECK_CALC_LALR([%name-prefix="calc"]) dnl test deprecated `='
|
||||||
AT_CHECK_CALC_LALR([%verbose])
|
AT_CHECK_CALC_LALR([%verbose])
|
||||||
AT_CHECK_CALC_LALR([%yacc])
|
AT_CHECK_CALC_LALR([%yacc])
|
||||||
AT_CHECK_CALC_LALR([%error-verbose])
|
AT_CHECK_CALC_LALR([%error-verbose])
|
||||||
@@ -565,15 +565,15 @@ AT_CHECK_CALC_LALR([%pure-parser %locations])
|
|||||||
AT_CHECK_CALC_LALR([%push-parser %locations])
|
AT_CHECK_CALC_LALR([%push-parser %locations])
|
||||||
AT_CHECK_CALC_LALR([%error-verbose %locations])
|
AT_CHECK_CALC_LALR([%error-verbose %locations])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix="calc" %verbose %yacc])
|
AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR([%debug])
|
AT_CHECK_CALC_LALR([%debug])
|
||||||
AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc])
|
AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc])
|
AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||||
AT_CHECK_CALC_LALR([%push-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc])
|
AT_CHECK_CALC_LALR([%push-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
||||||
|
|
||||||
|
|
||||||
# ----------------------- #
|
# ----------------------- #
|
||||||
@@ -594,7 +594,7 @@ AT_CHECK_CALC_GLR()
|
|||||||
|
|
||||||
AT_CHECK_CALC_GLR([%defines])
|
AT_CHECK_CALC_GLR([%defines])
|
||||||
AT_CHECK_CALC_GLR([%locations])
|
AT_CHECK_CALC_GLR([%locations])
|
||||||
AT_CHECK_CALC_GLR([%name-prefix="calc"])
|
AT_CHECK_CALC_GLR([%name-prefix "calc"])
|
||||||
AT_CHECK_CALC_GLR([%verbose])
|
AT_CHECK_CALC_GLR([%verbose])
|
||||||
AT_CHECK_CALC_GLR([%yacc])
|
AT_CHECK_CALC_GLR([%yacc])
|
||||||
AT_CHECK_CALC_GLR([%error-verbose])
|
AT_CHECK_CALC_GLR([%error-verbose])
|
||||||
@@ -602,14 +602,14 @@ AT_CHECK_CALC_GLR([%error-verbose])
|
|||||||
AT_CHECK_CALC_GLR([%pure-parser %locations])
|
AT_CHECK_CALC_GLR([%pure-parser %locations])
|
||||||
AT_CHECK_CALC_GLR([%error-verbose %locations])
|
AT_CHECK_CALC_GLR([%error-verbose %locations])
|
||||||
|
|
||||||
AT_CHECK_CALC_GLR([%error-verbose %locations %defines %name-prefix="calc" %verbose %yacc])
|
AT_CHECK_CALC_GLR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_GLR([%debug])
|
AT_CHECK_CALC_GLR([%debug])
|
||||||
AT_CHECK_CALC_GLR([%error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc])
|
AT_CHECK_CALC_GLR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc])
|
AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------- #
|
# ----------------------------- #
|
||||||
@@ -626,13 +626,13 @@ m4_define([AT_CHECK_CALC_LALR1_CC],
|
|||||||
[AT_CHECK_CALC([%skeleton "lalr1.cc" %defines %locations] $@)])
|
[AT_CHECK_CALC([%skeleton "lalr1.cc" %defines %locations] $@)])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR1_CC([])
|
AT_CHECK_CALC_LALR1_CC([])
|
||||||
AT_CHECK_CALC_LALR1_CC([%error-verbose %name-prefix="calc" %verbose %yacc])
|
AT_CHECK_CALC_LALR1_CC([%error-verbose %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR1_CC([%error-verbose %debug %name-prefix="calc" %verbose %yacc])
|
AT_CHECK_CALC_LALR1_CC([%error-verbose %debug %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix="calc" %verbose %yacc])
|
AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -650,11 +650,11 @@ m4_define([AT_CHECK_CALC_GLR_CC],
|
|||||||
[AT_CHECK_CALC([%skeleton "glr.cc" %defines %locations] $@)])
|
[AT_CHECK_CALC([%skeleton "glr.cc" %defines %locations] $@)])
|
||||||
|
|
||||||
AT_CHECK_CALC_GLR_CC([])
|
AT_CHECK_CALC_GLR_CC([])
|
||||||
AT_CHECK_CALC_GLR_CC([%error-verbose %name-prefix="calc" %verbose %yacc])
|
AT_CHECK_CALC_GLR_CC([%error-verbose %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_GLR_CC([%debug])
|
AT_CHECK_CALC_GLR_CC([%debug])
|
||||||
AT_CHECK_CALC_GLR_CC([%error-verbose %debug %name-prefix="calc" %verbose %yacc])
|
AT_CHECK_CALC_GLR_CC([%error-verbose %debug %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix="calc" %verbose %yacc])
|
AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ AT_SETUP([export YYLTYPE])
|
|||||||
AT_DATA_GRAMMAR([input.y],
|
AT_DATA_GRAMMAR([input.y],
|
||||||
[%locations
|
[%locations
|
||||||
|
|
||||||
%name-prefix="my_"
|
%name-prefix "my_"
|
||||||
%{
|
%{
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ m4_pushdef([AT_PURE_AND_LOC_IF],
|
|||||||
m4_pushdef([AT_GLR_OR_PARAM_IF],
|
m4_pushdef([AT_GLR_OR_PARAM_IF],
|
||||||
[m4_bmatch([$3], [%glr-parser\|%parse-param], [$1], [$2])])
|
[m4_bmatch([$3], [%glr-parser\|%parse-param], [$1], [$2])])
|
||||||
m4_pushdef([AT_NAME_PREFIX],
|
m4_pushdef([AT_NAME_PREFIX],
|
||||||
[m4_bmatch([$3], [%name-prefix=".*"],
|
[m4_bmatch([$3], [%name-prefix ".*"],
|
||||||
[m4_bregexp([$3], [name-prefix="\([^"]*\)"], [\1])],
|
[m4_bregexp([$3], [name-prefix "\([^"]*\)"], [\1])],
|
||||||
[yy])])
|
[yy])])
|
||||||
# yyerror receives the location if %location & %pure & (%glr or %parse-param).
|
# yyerror receives the location if %location & %pure & (%glr or %parse-param).
|
||||||
m4_pushdef([AT_YYERROR_ARG_LOC_IF],
|
m4_pushdef([AT_YYERROR_ARG_LOC_IF],
|
||||||
|
|||||||
@@ -64,13 +64,13 @@ AT_CHECK_OUTPUT([foo.y], [%defines %verbose %yacc],[],
|
|||||||
AT_CHECK_OUTPUT([foo.yy], [%defines %verbose %yacc],[],
|
AT_CHECK_OUTPUT([foo.yy], [%defines %verbose %yacc],[],
|
||||||
[y.output y.tab.c y.tab.h])
|
[y.output y.tab.c y.tab.h])
|
||||||
|
|
||||||
# Exercise %output and %file-prefix
|
# Exercise %output and %file-prefix including deprecated `='
|
||||||
AT_CHECK_OUTPUT([foo.y], [%file-prefix="bar" %defines %verbose], [],
|
AT_CHECK_OUTPUT([foo.y], [%file-prefix "bar" %defines %verbose], [],
|
||||||
[bar.output bar.tab.c bar.tab.h])
|
[bar.output bar.tab.c bar.tab.h])
|
||||||
AT_CHECK_OUTPUT([foo.y], [%output="bar.c" %defines %verbose %yacc],[],
|
AT_CHECK_OUTPUT([foo.y], [%output="bar.c" %defines %verbose %yacc],[],
|
||||||
[bar.output bar.c bar.h])
|
[bar.output bar.c bar.h])
|
||||||
AT_CHECK_OUTPUT([foo.y],
|
AT_CHECK_OUTPUT([foo.y],
|
||||||
[%file-prefix="baz" %output="bar.c" %defines %verbose %yacc],
|
[%file-prefix="baz" %output "bar.c" %defines %verbose %yacc],
|
||||||
[],
|
[],
|
||||||
[bar.output bar.c bar.h])
|
[bar.output bar.c bar.h])
|
||||||
|
|
||||||
@@ -86,6 +86,10 @@ AT_CHECK_OUTPUT([foo.yy], [],
|
|||||||
[--defines=foo.hpp -o foo.c++],
|
[--defines=foo.hpp -o foo.c++],
|
||||||
[foo.c++ foo.hpp])
|
[foo.c++ foo.hpp])
|
||||||
|
|
||||||
|
AT_CHECK_OUTPUT([foo.yy], [%defines "foo.hpp"],
|
||||||
|
[-o foo.c++],
|
||||||
|
[foo.c++ foo.hpp])
|
||||||
|
|
||||||
AT_CHECK_OUTPUT([foo.yy], [],
|
AT_CHECK_OUTPUT([foo.yy], [],
|
||||||
[-o foo.c++ --graph=foo.gph],
|
[-o foo.c++ --graph=foo.gph],
|
||||||
[foo.c++ foo.gph])
|
[foo.c++ foo.gph])
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ AT_SETUP([Useless Terminals])
|
|||||||
|
|
||||||
AT_DATA([[input.y]],
|
AT_DATA([[input.y]],
|
||||||
[[%verbose
|
[[%verbose
|
||||||
%output="input.c"
|
%output "input.c"
|
||||||
|
|
||||||
%token useless1
|
%token useless1
|
||||||
%token useless2
|
%token useless2
|
||||||
@@ -71,7 +71,7 @@ AT_SETUP([Useless Nonterminals])
|
|||||||
|
|
||||||
AT_DATA([[input.y]],
|
AT_DATA([[input.y]],
|
||||||
[[%verbose
|
[[%verbose
|
||||||
%output="input.c"
|
%output "input.c"
|
||||||
|
|
||||||
%nterm useless1
|
%nterm useless1
|
||||||
%nterm useless2
|
%nterm useless2
|
||||||
@@ -128,7 +128,7 @@ AT_KEYWORDS([report])
|
|||||||
|
|
||||||
AT_DATA([[input.y]],
|
AT_DATA([[input.y]],
|
||||||
[[%verbose
|
[[%verbose
|
||||||
%output="input.c"
|
%output "input.c"
|
||||||
%token useful
|
%token useful
|
||||||
%%
|
%%
|
||||||
exp: useful;
|
exp: useful;
|
||||||
@@ -221,7 +221,7 @@ AT_DATA([[not-reduced.y]],
|
|||||||
/* A useful one. */
|
/* A useful one. */
|
||||||
%token useful
|
%token useful
|
||||||
%verbose
|
%verbose
|
||||||
%output="not-reduced.c"
|
%output "not-reduced.c"
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ AT_DATA([[reduced.y]],
|
|||||||
/* A useful one. */
|
/* A useful one. */
|
||||||
%token useful
|
%token useful
|
||||||
%verbose
|
%verbose
|
||||||
%output="reduced.c"
|
%output "reduced.c"
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@@ -304,7 +304,7 @@ AT_KEYWORDS([report])
|
|||||||
|
|
||||||
AT_DATA([[input.y]],
|
AT_DATA([[input.y]],
|
||||||
[[%verbose
|
[[%verbose
|
||||||
%output="input.c"
|
%output "input.c"
|
||||||
%token useful
|
%token useful
|
||||||
%%
|
%%
|
||||||
exp: useful | underivable;
|
exp: useful | underivable;
|
||||||
@@ -342,7 +342,7 @@ AT_CLEANUP
|
|||||||
AT_SETUP([Empty Language])
|
AT_SETUP([Empty Language])
|
||||||
|
|
||||||
AT_DATA([[input.y]],
|
AT_DATA([[input.y]],
|
||||||
[[%output="input.c"
|
[[%output "input.c"
|
||||||
%%
|
%%
|
||||||
exp: exp;
|
exp: exp;
|
||||||
]])
|
]])
|
||||||
|
|||||||
Reference in New Issue
Block a user