Commit b52d2107 authored by Dominik Charousset's avatar Dominik Charousset

Emit ec::unexpected_newline automatically

parent 4c894a79
......@@ -18,6 +18,13 @@
#pragma once
#define CAF_FSM_EVAL_MISMATCH_EC \
if (mismatch_ec == ec::unexpected_character) \
ps.code = ch != '\n' ? mismatch_ec : ec::unexpected_newline; \
else \
ps.code = mismatch_ec; \
return;
#define start() \
char ch = ps.current(); \
goto s_init; \
......@@ -28,8 +35,7 @@
static constexpr ec mismatch_ec = ec::unexpected_character
#define state(name) \
ps.code = mismatch_ec; \
return; \
CAF_FSM_EVAL_MISMATCH_EC \
} \
{ \
static constexpr ec mismatch_ec = ec::unexpected_character; \
......@@ -39,8 +45,7 @@
e_##name : __attribute__((unused));
#define term_state(name) \
ps.code = mismatch_ec; \
return; \
CAF_FSM_EVAL_MISMATCH_EC \
} \
{ \
static constexpr ec mismatch_ec = ec::trailing_character; \
......@@ -50,8 +55,7 @@
e_##name : __attribute__((unused));
#define fin() \
ps.code = mismatch_ec; \
return; \
CAF_FSM_EVAL_MISMATCH_EC \
} \
s_fin: \
ps.code = ec::success; \
......
......@@ -64,7 +64,6 @@ void read_atom(state<Iterator, Sentinel>& ps, Consumer& consumer) {
state(read_chars) {
input(is_char<'\''>, done)
checked_action(is_legal, read_chars, append(ch), ec::too_many_characters)
invalid_input(is_char<'\n'>, ec::unexpected_newline)
}
term_state(done) {
input(is_char<' '>, done)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment