forked from OctaForge/libcubescript
force strings to be finished
parent
43e272c7e0
commit
1b25b64ae5
|
@ -30,6 +30,7 @@ advantages, including:
|
||||||
* Modern C++14 API (no macros, strongly typed enums, lambdas, ranges etc.)
|
* 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)
|
* C++14 lambdas can be used as commands (including captures and type inference)
|
||||||
* Error handling including recovery (protected call system similar to Lua)
|
* Error handling including recovery (protected call system similar to Lua)
|
||||||
|
* Stricter parsing (strings cannot be left unfinished)
|
||||||
* Loop control statements (`break` and `continue`)
|
* Loop control statements (`break` and `continue`)
|
||||||
* No manual memory mangement, values manage themselves
|
* No manual memory mangement, values manage themselves
|
||||||
* Clean codebase that is easy to read and contribute to
|
* 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:
|
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)
|
* A degree of thread safety (see below)
|
||||||
* Custom allocator support (control over how heap memory is allocated)
|
* Custom allocator support (control over how heap memory is allocated)
|
||||||
* Coroutines
|
* Coroutines
|
||||||
|
|
|
@ -74,6 +74,7 @@ static ostd::ConstCharRange cs_parse_str(ostd::ConstCharRange str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ostd::ConstCharRange GenState::get_str() {
|
ostd::ConstCharRange GenState::get_str() {
|
||||||
|
char const *ln = source;
|
||||||
char const *beg = source + 1;
|
char const *beg = source + 1;
|
||||||
source = beg;
|
source = beg;
|
||||||
for (; current(); next_char()) {
|
for (; current(); next_char()) {
|
||||||
|
@ -92,9 +93,10 @@ ostd::ConstCharRange GenState::get_str() {
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
auto ret = ostd::ConstCharRange(beg, source);
|
auto ret = ostd::ConstCharRange(beg, source);
|
||||||
if (current() == '\"') {
|
if (current() != '\"') {
|
||||||
next_char();
|
cs_error_line(*this, ln, "unfinished string '%s'", ln);
|
||||||
}
|
}
|
||||||
|
next_char();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue