|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61340 - in trunk/libs/spirit/example/scheme: example/sexpr input
From: joel_at_[hidden]
Date: 2010-04-17 11:58:29
Author: djowel
Date: 2010-04-17 11:58:29 EDT (Sat, 17 Apr 2010)
New Revision: 61340
URL: http://svn.boost.org/trac/boost/changeset/61340
Log:
incorporated error handling and added error reporting tests.
Text files modified:
trunk/libs/spirit/example/scheme/example/sexpr/sexpr_error_test.cpp | 4 +++-
trunk/libs/spirit/example/scheme/input/error_handler.hpp | 13 +++++++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
Modified: trunk/libs/spirit/example/scheme/example/sexpr/sexpr_error_test.cpp
==============================================================================
--- trunk/libs/spirit/example/scheme/example/sexpr/sexpr_error_test.cpp (original)
+++ trunk/libs/spirit/example/scheme/example/sexpr/sexpr_error_test.cpp 2010-04-17 11:58:29 EDT (Sat, 17 Apr 2010)
@@ -43,7 +43,9 @@
test("(abc \n(\"a string\" 456) \ndef)", "ok.sexpr");
test("(abc \n(\"a string\" 456 \ndef)", "missing close paren.sexpr");
test("(abc \n(\"a string 456) \ndef)", "missing double quote.sexpr");
- test("(abc \n(\"a string\" 0ggg) \ndef)", "erronoeus octal.sexpr");
+ test("(abc \n(\"a string\" 0xggg) \ndef)", "erronoeus hex.sexpr");
+ test("(abc \n(\"a \\zstring\" 999) \ndef)", "erronoeus escape.sexpr");
+ test("(abc \n(\"a \uzstring\" 999) \ndef)", "erronoeus escape.sexpr");
return 0;
}
Modified: trunk/libs/spirit/example/scheme/input/error_handler.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/input/error_handler.hpp (original)
+++ trunk/libs/spirit/example/scheme/input/error_handler.hpp 2010-04-17 11:58:29 EDT (Sat, 17 Apr 2010)
@@ -40,10 +40,19 @@
if (source_file != "")
std::cerr << '(' << line << ')';
else
- std::cerr << "line(" << line << ')';
+ std::cerr << '(' << line << ')';
}
- std::cerr << " : Error! Expecting " << what << std::endl;
+ std::cerr << " : Error! Expecting " << what;
+ //~ if (line != -1)
+ //~ {
+ //~ std::size_t col = get_column(first, err_pos, 4);
+ //~ std::cerr << " near column " << col << std::endl;
+ //~ }
+ //~ else
+ //~ {
+ std::cerr << std::endl;
+ //~ }
}
};
}}
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