mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 23:03:04 +00:00
* doc/bison.texinfo (Calc++ Parsing Driver): Let "parse" return an
error code. (Calc++ Scanner): Exit with failure if we can't open the input file. Accept "-" standing for stdin. (Calc++ Top Level): Print the result only if the parsing was successful.
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
|||||||
|
2007-01-16 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* doc/bison.texinfo (Calc++ Parsing Driver): Let "parse" return an
|
||||||
|
error code.
|
||||||
|
(Calc++ Scanner): Exit with failure if we can't open the input
|
||||||
|
file.
|
||||||
|
Accept "-" standing for stdin.
|
||||||
|
(Calc++ Top Level): Print the result only if the parsing was
|
||||||
|
successful.
|
||||||
|
|
||||||
2007-01-16 Akim Demaille <akim@epita.fr>
|
2007-01-16 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* data/lalr1.cc (yy_reduce_print_): Add a missing end-of-line.
|
* data/lalr1.cc (yy_reduce_print_): Add a missing end-of-line.
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ This manual is for @acronym{GNU} Bison (version @value{VERSION},
|
|||||||
@value{UPDATED}), the @acronym{GNU} parser generator.
|
@value{UPDATED}), the @acronym{GNU} parser generator.
|
||||||
|
|
||||||
Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998,
|
Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998,
|
||||||
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
@quotation
|
@quotation
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
@@ -7789,8 +7789,8 @@ Similarly for the parser itself.
|
|||||||
|
|
||||||
@comment file: calc++-driver.hh
|
@comment file: calc++-driver.hh
|
||||||
@example
|
@example
|
||||||
// Handling the parser.
|
// Run the parser. Return 0 on success.
|
||||||
void parse (const std::string& f);
|
int parse (const std::string& f);
|
||||||
std::string file;
|
std::string file;
|
||||||
bool trace_parsing;
|
bool trace_parsing;
|
||||||
@end example
|
@end example
|
||||||
@@ -7831,15 +7831,16 @@ calcxx_driver::~calcxx_driver ()
|
|||||||
@{
|
@{
|
||||||
@}
|
@}
|
||||||
|
|
||||||
void
|
int
|
||||||
calcxx_driver::parse (const std::string &f)
|
calcxx_driver::parse (const std::string &f)
|
||||||
@{
|
@{
|
||||||
file = f;
|
file = f;
|
||||||
scan_begin ();
|
scan_begin ();
|
||||||
yy::calcxx_parser parser (*this);
|
yy::calcxx_parser parser (*this);
|
||||||
parser.set_debug_level (trace_parsing);
|
parser.set_debug_level (trace_parsing);
|
||||||
parser.parse ();
|
int res = parser.parse ();
|
||||||
scan_end ();
|
scan_end ();
|
||||||
|
return res;
|
||||||
@}
|
@}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -8135,8 +8136,13 @@ void
|
|||||||
calcxx_driver::scan_begin ()
|
calcxx_driver::scan_begin ()
|
||||||
@{
|
@{
|
||||||
yy_flex_debug = trace_scanning;
|
yy_flex_debug = trace_scanning;
|
||||||
if (!(yyin = fopen (file.c_str (), "r")))
|
if (file == "-")
|
||||||
error (std::string ("cannot open ") + file);
|
yyin = stdin;
|
||||||
|
else if (!(yyin = fopen (file.c_str (), "r")))
|
||||||
|
@{
|
||||||
|
error (std::string ("cannot open ") + file);
|
||||||
|
exit (1);
|
||||||
|
@}
|
||||||
@}
|
@}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -8165,11 +8171,8 @@ main (int argc, char *argv[])
|
|||||||
driver.trace_parsing = true;
|
driver.trace_parsing = true;
|
||||||
else if (*argv == std::string ("-s"))
|
else if (*argv == std::string ("-s"))
|
||||||
driver.trace_scanning = true;
|
driver.trace_scanning = true;
|
||||||
else
|
else if (!driver.parse (*argv))
|
||||||
@{
|
std::cout << driver.result << std::endl;
|
||||||
driver.parse (*argv);
|
|
||||||
std::cout << driver.result << std::endl;
|
|
||||||
@}
|
|
||||||
@}
|
@}
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user