summaryrefslogtreecommitdiff
path: root/libadhocutil/lexer.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-12-30 20:04:34 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2016-12-30 20:04:34 +0000
commit2794d881c15efef0de4b51cc1a8f0649181d7af9 (patch)
tree91f71124130faf5ca4b7273fc8c53601efe86e28 /libadhocutil/lexer.cpp
parentAdd macros to ease declartion of formatters (diff)
downloadlibadhocutil-2794d881c15efef0de4b51cc1a8f0649181d7af9.tar.bz2
libadhocutil-2794d881c15efef0de4b51cc1a8f0649181d7af9.tar.xz
libadhocutil-2794d881c15efef0de4b51cc1a8f0649181d7af9.zip
Use compile time formatter in place of boost::format where suitable and improve exception messages in many placeslibadhocutil-0.4
Diffstat (limited to 'libadhocutil/lexer.cpp')
-rw-r--r--libadhocutil/lexer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libadhocutil/lexer.cpp b/libadhocutil/lexer.cpp
index 83d2666..3dd1e0e 100644
--- a/libadhocutil/lexer.cpp
+++ b/libadhocutil/lexer.cpp
@@ -1,4 +1,5 @@
#include "lexer.h"
+#include "compileTimeFormatter.h"
namespace AdHoc {
const Lexer::State Lexer::InitialState = "";
@@ -11,6 +12,7 @@ namespace AdHoc {
{
}
+ AdHocFormatter(UnexpectedInputState, "Unexpected input in state (%?) at %?");
void
Lexer::extract(const gchar * string, size_t length) const
{
@@ -29,7 +31,7 @@ namespace AdHoc {
}
}
if (!selected) {
- throw std::runtime_error(std::string("Unexpected input in state (" + es.getState() + ") at ") + (string + es.pos));
+ throw std::runtime_error(UnexpectedInputState::get(es.getState(), string + es.pos));
}
es.pat = boost::get<1>(*selected);
const auto & h = boost::get<2>(*selected);