Update of /cvsroot/boost/boost/libs/wave/samples/hannibal
In directory
sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9727/libs/wave/samples/hannibal
Modified Files:
hannibal.cpp
Log Message:
Fixed exception specifications to catch exceptions as const&.
Index: hannibal.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/wave/samples/hannibal/hannibal.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hannibal.cpp 21 Jun 2006 02:57:30 -0000 1.1
+++ hannibal.cpp 24 Jun 2006 16:59:45 -0000 1.2
@@ -33,24 +33,26 @@
#include "translation_unit_parser.h"
#include "translation_unit_skipper.h"
+#if HANNIBAL_DUMP_PARSE_TREE != 0
///////////////////////////////////////////////////////////////////////////////
namespace {
+ ///////////////////////////////////////////////////////////////////////////
+ // helper routines needed to generate the parse tree XML dump
typedef boost::wave::cpplexer::lex_token<> token_type;
- inline int
- get_token_id(token_type const &t)
+ int get_token_id(token_type const &t)
{
return boost::wave::token_id(t);
}
- inline token_type::string_type
- get_token_value(token_type const &t)
+ token_type::string_type get_token_value(token_type const &t)
{
return t.get_value();
}
}
+#endif
///////////////////////////////////////////////////////////////////////////////
// main entry point
@@ -76,7 +78,7 @@
}
instream.unsetf(std::ios::skipws);
instring =
std::string(std::istreambuf_iterator<char>(instream.rdbuf()),
- std::istreambuf_iterator<char>());
+ std::istreambuf_iterator<char>());
// The template boost::wave::cpplexer::lex_token<> is the token type to
be
// used by the Wave library.
@@ -118,33 +120,39 @@
// parse the input file
result_type pi = boost::spirit::ast_parse(first, last, g, s);
-
+
if (pi.full) {
std::cout << "Hannibal: parsed sucessfully: " << argv[1]
<< std::endl;
-
+
#if HANNIBAL_DUMP_PARSE_TREE != 0
// generate xml dump from parse tree, if requested
boost::spirit::tree_to_xml(std::cerr, pi.trees, "", rule_map,
&get_token_id, &get_token_value);
#endif
}
+ else {
+ std::cout << "Hannibal: parsing failed: " << argv[1]
+ << std::endl;
+ std::cout << "Hannibal: last recognized token was: " << *pi.stop
+ << std::endl;
+ }
}
- catch (boost::wave::cpp_exception &e) {
+ catch (boost::wave::cpp_exception const& e) {
// some preprocessing error
std::cerr
<< e.file_name() << ":" << e.line_no() << ":" << e.column_no() <<
": "
<< e.description() << std::endl;
return 2;
}
- catch (boost::wave::cpplexer::lexing_exception const &e) {
+ catch (boost::wave::cpplexer::lexing_exception const& e) {
// some lexing error
std::cerr
<< e.file_name() << ":" << e.line_no() << ":" << e.column_no() <<
": "
<< e.description() << std::endl;
return 2;
}
- catch (std::exception &e) {
+ catch (std::exception const& e) {
// use last recognized token to retrieve the error position
std::cerr
<< current_position.get_file()
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs