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
9c5bb7bc
Commit
9c5bb7bc
authored
Jul 08, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add exit statements to terminal states
parent
dc9979fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
11 deletions
+34
-11
libcaf_core/caf/detail/parser/fsm.hpp
libcaf_core/caf/detail/parser/fsm.hpp
+34
-11
No files found.
libcaf_core/caf/detail/parser/fsm.hpp
View file @
9c5bb7bc
...
...
@@ -50,17 +50,6 @@
goto s_unexpected_eof; \
e_##name :
/// Defines a terminal state in the FSM.
#define term_state(name) \
CAF_FSM_EVAL_MISMATCH_EC \
} \
{ \
static constexpr auto mismatch_ec = caf::pec::trailing_character; \
s_##name : \
if (ch == '\0') \
goto s_fin; \
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.
#define unstable_state(name) \
...
...
@@ -79,6 +68,31 @@
ps.code = caf::pec::success; \
return;
/// 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; \
s_##name : \
if (ch == '\0') \
goto s_fin; \
e_##name :
/// Defines a terminal state in the FSM.
#define CAF_TERM_STATE_IMPL2(name, exit_statement) \
CAF_FSM_EVAL_MISMATCH_EC \
} \
{ \
static constexpr auto mismatch_ec = caf::pec::trailing_character; \
s_##name : \
if (ch == '\0') { \
exit_statement; \
goto s_fin; \
} \
e_##name :
#define CAF_TRANSITION_IMPL1(target) \
ch = ps.next(); \
goto s_##target;
...
...
@@ -193,6 +207,11 @@
#ifdef CAF_MSVC
/// Defines a terminal state in the FSM.
#define term_state(...) \
CAF_PP_CAT(CAF_PP_OVERLOAD(CAF_TERM_STATE_IMPL, __VA_ARGS__)(__VA_ARGS__), \
CAF_PP_EMPTY())
/// Transitions to target state if a predicate (optional argument 1) holds for
/// the current token and executes an action (optional argument 2) before
/// entering the new state.
...
...
@@ -223,6 +242,10 @@
#else // CAF_MSVC
/// Defines a terminal state in the FSM.
#define term_state(...) \
CAF_PP_OVERLOAD(CAF_TERM_STATE_IMPL, __VA_ARGS__)(__VA_ARGS__)
/// Transitions to target state if a predicate (optional argument 1) holds for
/// the current token and executes an action (optional argument 2) before
/// entering the new state.
...
...
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