summaryrefslogtreecommitdiffstats
path: root/src/uscxml/Interpreter.cpp
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2015-04-02 11:44:48 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2015-04-02 11:44:48 (GMT)
commit81aa1c79dd158aa7bc76876552e4b1d05ecea656 (patch)
tree4b590410d4042c156cfd3d4e874f3a329390a72b /src/uscxml/Interpreter.cpp
parentff86d690dc02d7dd495000331d378e7d8eb688ac (diff)
downloaduscxml-81aa1c79dd158aa7bc76876552e4b1d05ecea656.zip
uscxml-81aa1c79dd158aa7bc76876552e4b1d05ecea656.tar.gz
uscxml-81aa1c79dd158aa7bc76876552e4b1d05ecea656.tar.bz2
Reactivated PHP bindings and some work on PROMELA
Diffstat (limited to 'src/uscxml/Interpreter.cpp')
-rw-r--r--src/uscxml/Interpreter.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 060a397..1b2ca15 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -2260,7 +2260,7 @@ bool InterpreterImpl::nameMatch(const std::string& eventDescs, const std::string
return true;
// eventDesc has to be a real prefix of event now and therefore shorter
- if (eventDesc.size() >= eventName.size())
+ if (eventDesc.size() > eventName.size())
goto NEXT_DESC;
// are they already equal?
@@ -2910,17 +2910,19 @@ NodeSet<std::string> InterpreterImpl::getTargetStates(const Arabica::XPath::Node
return targets;
}
-std::list<std::string> InterpreterImpl::tokenize(const std::string& line, const char sep) {
+#define ISWHITESPACE(char) (isspace(char))
+
+std::list<std::string> InterpreterImpl::tokenize(const std::string& line, const char sep, bool trimWhiteSpace) {
std::list<std::string> tokens;
// appr. 3x faster than stringstream
size_t start = 0;
for (int i = 0; i < line.size(); i++) {
- if (line[i] == sep) {
+ if (line[i] == sep || (trimWhiteSpace && ISWHITESPACE(line[i]))) {
if (i > 0 && start < i) {
tokens.push_back(line.substr(start, i - start));
}
- while(line[++i] == sep); // skip multiple occurences of seperator
+ while(line[i] == sep || (trimWhiteSpace && ISWHITESPACE(line[i]))) { i++; } // skip multiple occurences of seperator and whitespaces
start = i;
} else if (i + 1 == line.size()) {
tokens.push_back(line.substr(start, i + 1 - start));