Skip to content
Snippets Groups Projects
Commit 550d676e authored by Jan Trávníček's avatar Jan Trávníček
Browse files

acat2 add string

parent 5d852f78
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,11 @@ void getRegExp(std::list<sax::Token>& tokens) { ...@@ -28,6 +28,11 @@ void getRegExp(std::list<sax::Token>& tokens) {
std::cout << regexp; std::cout << regexp;
} }
   
void getString(std::list<sax::Token>& tokens) {
string::String string = alib::FromXMLParsers::stringParser.parseValue(tokens);
std::cout << string;
}
int main(int argc, char** argv) { int main(int argc, char** argv) {
if(argc == 2 && std::string(argv[1])=="-v" ) { if(argc == 2 && std::string(argv[1])=="-v" ) {
std::cout << argv[0] << " version " << VERSION << "\n"; std::cout << argv[0] << " version " << VERSION << "\n";
...@@ -54,11 +59,13 @@ int main(int argc, char** argv) { ...@@ -54,11 +59,13 @@ int main(int argc, char** argv) {
sax::SaxParseInterface::parseFile(argv[optind],tokens); sax::SaxParseInterface::parseFile(argv[optind],tokens);
} }
   
if (tokens.front().getData() == "automaton") { if (alib::FromXMLParsers::automatonParser.first(tokens)) {
getAutomaton(tokens); getAutomaton(tokens);
} else if (tokens.front().getData() == "regexp") { } else if (alib::FromXMLParsers::regexpParser.first(tokens)) {
getRegExp(tokens); getRegExp(tokens);
} else if (alib::FromXMLParsers::stringParser.first(tokens)) {
getString(tokens);
} else { } else {
throw alib::AlibException( "Expected root tag automaton, grammar or regexp. Read: " + tokens.front().getData()); throw alib::AlibException( "Expected root tag automaton, grammar, regexp or string. Read: " + tokens.front().getData());
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment