Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53269 - trunk/libs/graph/src
From: jewillco_at_[hidden]
Date: 2009-05-25 21:13:37


Author: jewillco
Date: 2009-05-25 21:13:36 EDT (Mon, 25 May 2009)
New Revision: 53269
URL: http://svn.boost.org/trac/boost/changeset/53269

Log:
Fixed handling of lex errors at end of input
Text files modified:
   trunk/libs/graph/src/read_graphviz_new.cpp | 8 ++++++--
   1 files changed, 6 insertions(+), 2 deletions(-)

Modified: trunk/libs/graph/src/read_graphviz_new.cpp
==============================================================================
--- trunk/libs/graph/src/read_graphviz_new.cpp (original)
+++ trunk/libs/graph/src/read_graphviz_new.cpp 2009-05-25 21:13:36 EDT (Mon, 25 May 2009)
@@ -113,7 +113,11 @@
   };
 
   bad_graphviz_syntax lex_error(const std::string& errmsg, char bad_char) {
- return bad_graphviz_syntax(errmsg + " (char is '" + bad_char + "')");
+ if (bad_char == '\0') {
+ return bad_graphviz_syntax(errmsg + " (at end of input)");
+ } else {
+ return bad_graphviz_syntax(errmsg + " (char is '" + bad_char + "')");
+ }
   }
 
   bad_graphviz_syntax parse_error(const std::string& errmsg, const token& bad_token) {
@@ -306,7 +310,7 @@
     }
 
     void throw_lex_error(const std::string& errmsg) {
- boost::throw_exception(lex_error(errmsg, *begin));
+ boost::throw_exception(lex_error(errmsg, (begin == end ? '\0' : *begin)));
     }
   };
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk