]> ruin.nu Git - popboot.git/blobdiff - parser.y
more sane test
[popboot.git] / parser.y
index d39a88a34e9c01c5d25804c09e9e243c63ade085..663442a8a8bcd87259383c097e418eda5c9680d1 100644 (file)
--- a/parser.y
+++ b/parser.y
@@ -8,6 +8,7 @@
     #include <vector>
 
     #include "action.h"
+       #include "planner.h"
 
     using namespace std;
 
@@ -55,7 +56,7 @@ action        : id preconds '\n' exec effects '\n' {
                                cout << "id:  " << *$1 << endl;
 
                                // Precondition flags:
-                               cout << "a: " << (*$2)["a"] << endl;
+                               cout << "a: " << (*$2)["NET"] << endl;
                                cout << "b: " << (*$2)["b"] << endl;
                                cout << "c: " << (*$2)["c"] << endl;
                                cout << "d: " << (*$2)["d"] << endl;
@@ -64,7 +65,7 @@ action        : id preconds '\n' exec effects '\n' {
                                cout << "exe: " << *$4 << endl;
 
                                // Print number of effects
-                               cout << "1: " << (*$5)[1].size() << endl;
+                               cout << "1: " << (*$5)[0].size() << endl;
                                cout << "99: " << (*$5)[99].size() << endl;
                                cout << "88: " << (*$5)[88].size() << endl;
 
@@ -195,6 +196,16 @@ yyerror (char const *s)
     cerr << "Parse error : " << s;
 }
 
+vector<string> stringToVector(string str){
+       vector<string> strings;
+
+       istringstream ist(str);
+       while (ist >> str){
+               strings.push_back(str);
+       }
+
+       return strings;
+}
 
 int 
 main (int argc, char** argv)
@@ -219,4 +230,7 @@ main (int argc, char** argv)
     actions = new vector<Action>();
 
     yyparse();
+
+       Planner p(*actions, stringToVector(argv[2]), stringToVector(argv[3]));
+       p.execute();
 }