diff --git a/README.md b/README.md index a5b38517..069df61c 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ advantages, including: * Modern C++14 API (no macros, strongly typed enums, lambdas, ranges etc.) * C++14 lambdas can be used as commands (including captures and type inference) * Error handling including recovery (protected call system similar to Lua) +* Stricter parsing (strings cannot be left unfinished) * Loop control statements (`break` and `continue`) * No manual memory mangement, values manage themselves * Clean codebase that is easy to read and contribute to @@ -38,6 +39,7 @@ advantages, including: There are some features that are a work in progress and will come later: +* More helpful debug information (proper line infos at both parse and run time) * A degree of thread safety (see below) * Custom allocator support (control over how heap memory is allocated) * Coroutines diff --git a/src/cs_gen.cc b/src/cs_gen.cc index 8d5cfa3b..f162c2f3 100644 --- a/src/cs_gen.cc +++ b/src/cs_gen.cc @@ -74,6 +74,7 @@ static ostd::ConstCharRange cs_parse_str(ostd::ConstCharRange str) { } ostd::ConstCharRange GenState::get_str() { + char const *ln = source; char const *beg = source + 1; source = beg; for (; current(); next_char()) { @@ -92,9 +93,10 @@ ostd::ConstCharRange GenState::get_str() { } done: auto ret = ostd::ConstCharRange(beg, source); - if (current() == '\"') { - next_char(); + if (current() != '\"') { + cs_error_line(*this, ln, "unfinished string '%s'", ln); } + next_char(); return ret; }