- unsigned nondigit = 10;
- while(nondigit<s.size() && isdigit(s[nondigit]))
- ++nondigit;
- return Row(WAIT, lexical_cast<unsigned>(s.substr(9, nondigit-9)));
+ if(!s.compare(7, 3, "to "))
+ return Row(TRAVEL, s.substr(10));
+ else if(!s.compare(7, string::npos, "until arrival"))
+ return Row(ARRIVE);
+ }
+ else if(!s.compare(0, 9, "wait for "))
+ {
+ if(isdigit(s[9]))
+ {
+ unsigned nondigit = 10;
+ while(nondigit<s.size() && isdigit(s[nondigit]))
+ ++nondigit;
+ return Row(WAIT_TIME, lexical_cast<unsigned>(s.substr(9, nondigit-9)));
+ }
+ else if(!s.compare(9, 6, "train "))
+ {
+ string::size_type at = s.find(" at ", 15);
+ if(at!=string::npos)
+ {
+ Row row(WAIT_TRAIN, lexical_cast<unsigned>(s.substr(15, at-15)));
+ row.params.push_back(s.substr(at+4));
+ return row;
+ }
+ }