From 179c199ece47d2f03e57509a6e3da87fce34c0e5 Mon Sep 17 00:00:00 2001 From: Artur Meski Date: Wed, 28 Mar 2018 15:35:48 +0100 Subject: [PATCH] Processes, switching --- rs.cc | 5 +++++ rs.hh | 3 +++ rsin_parser.yy | 16 +++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/rs.cc b/rs.cc index 9ed9d26..42558f6 100644 --- a/rs.cc +++ b/rs.cc @@ -54,6 +54,11 @@ Entity RctSys::getEntityID(std::string name) return entities_names[name]; } +void RctSys::setCurrentProcess(std::string processName) +{ + VERB_LN(2, "Current Process: " << processName); +} + void RctSys::pushReactant(std::string entityName) { if (!hasEntity(entityName)) diff --git a/rs.hh b/rs.hh index 00bf7fa..1c40459 100644 --- a/rs.hh +++ b/rs.hh @@ -40,6 +40,9 @@ class RctSys bool hasEntity(std::string entityName); void addEntity(std::string entityName); std::string getEntityName(Entity entityID); + + void setCurrentProcess(std::string processName); + void pushReactant(std::string entityName); void pushInhibitor(std::string entityName); void pushProduct(std::string entityName); diff --git a/rsin_parser.yy b/rsin_parser.yy index 1038cec..c947743 100644 --- a/rsin_parser.yy +++ b/rsin_parser.yy @@ -77,7 +77,7 @@ class rsin_driver; system: | OPTIONS LCB options RCB system - | REACTIONS LCB reactions RCB system + | REACTIONS LCB reactionsets RCB system | INITIALCONTEXTS LCB initstates RCB system | CONTEXTENTITIES LCB actionentities RCB system | CONTEXTAUTOMATON LCB ctxaut RCB system @@ -104,6 +104,20 @@ option: * REACTIONS * ------------------------- */ + +reactionsets: + | processname LCB reactions RCB SEMICOL + ; + +processname: IDENTIFIER { + //driver.getReactionSystem()->ctxAutAddState(*$1); + // + // Set the current process name for which we are saving reactions... + // + driver.getReactionSystem()->setCurrentProcess(*$1); + free($1); + } + reactions: | reactions reaction SEMICOL ;