Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
c448f565
Commit
c448f565
authored
Jul 10, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix behavior of term_state with exit statement
parent
1df50c94
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
+19
-16
libcaf_core/caf/detail/parser/fsm.hpp
libcaf_core/caf/detail/parser/fsm.hpp
+19
-16
No files found.
libcaf_core/caf/detail/parser/fsm.hpp
View file @
c448f565
...
...
@@ -37,32 +37,31 @@
ps.code = caf::pec::unexpected_eof; \
return; \
{ \
static
constexpr auto mismatch_ec = caf::pec::unexpected_character
static
_cast<void>(0); // dummy; init state closes parentheses
/// Defines a non-terminal state in the FSM.
#define state(name) \
CAF_FSM_EVAL_MISMATCH_EC \
} \
{ \
static constexpr auto mismatch_ec = caf::pec::unexpected_character; \
for (;;) { \
/* jumps back up here if no transition matches */
\
ps.code = ch != '\n' ? caf::pec::unexpected_character \
: caf::pec::unexpected_newline; \
return; \
s_##name : \
if (ch == '\0') \
goto s_unexpected_eof; \
e_##name :
/// Defines a state in the FSM that doesn't check for end-of-input. Unstable
/// states
are supposed to contain epsilon transitions only
.
/// states
must make a transition and cause undefined behavior otherwise
.
#define unstable_state(name) \
CAF_FSM_EVAL_MISMATCH_EC \
} \
{ \
static constexpr auto mismatch_ec = caf::pec::trailing_character; \
s_##name : \
e_##name :
/// Ends the definition of an FSM.
#define fin() \
CAF_FSM_EVAL_MISMATCH_EC \
} \
s_fin: \
ps.code = caf::pec::success; \
...
...
@@ -70,21 +69,25 @@
/// Defines a terminal state in the FSM.
#define CAF_TERM_STATE_IMPL1(name) \
CAF_FSM_EVAL_MISMATCH_EC \
} \
{ \
static constexpr auto mismatch_ec = caf::pec::trailing_character; \
for (;;) { \
/* jumps back up here if no transition matches */
\
ps.code = caf::pec::trailing_character; \
return; \
s_##name : \
if (ch == '\0') \
goto s_fin; \
e_##name :
/// Defines a terminal state in the FSM.
/// Defines a terminal state in the FSM that runs `exit_statement` when leaving
/// the state with code `pec::success` or `pec::trailing_character`.
#define CAF_TERM_STATE_IMPL2(name, exit_statement) \
CAF_FSM_EVAL_MISMATCH_EC \
} \
{ \
static constexpr auto mismatch_ec = caf::pec::trailing_character; \
for (;;) { \
/* jumps back up here if no transition matches */
\
ps.code = caf::pec::trailing_character; \
exit_statement; \
return; \
s_##name : \
if (ch == '\0') { \
exit_statement; \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment