22 #include <pddl_parser/pddl_parser.h>
30 std::ifstream t(
"domain.pddl");
33 t.seekg(0, std::ios::end);
34 str.reserve(t.tellg());
35 t.seekg(0, std::ios::beg);
37 str.assign((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
43 std::cout <<
"Error occurred during parsing: " << e.
what_no_backtrace() << std::endl;
47 std::cout <<
"success" << std::endl;
49 std::cout << dom.
name << std::endl;
50 std::cout <<
"requirements:" << std::endl;
52 std::cout <<
"\t" << s << std::endl;
54 std::cout <<
"types:" << std::endl;
55 for (std::pair<std::string, std::string> p : dom.
types) {
56 std::cout <<
"\t" << p.first <<
" - " << p.second << std::endl;
58 std::cout <<
"constants:" << std::endl;
59 for (std::pair<std::vector<std::string>, std::string> p : dom.
constants) {
61 for (std::string s : p.first) {
62 std::cout << s <<
" ";
64 std::cout <<
"- " << p.second << std::endl;
66 std::cout <<
"predicates:" << std::endl;
67 for (std::pair<std::string, std::vector<std::pair<std::string, std::string>>> p1 :
69 std::cout <<
"\t" << p1.first << std::endl;
70 for (std::pair<std::string, std::string> p2 : p1.second) {
71 std::cout <<
"\t\t" << p2.first <<
":" << p2.second << std::endl;
74 std::cout <<
"actions:" << std::endl;
76 std::cout <<
"\t" << a.name << std::endl;
77 for (std::pair<std::string, std::string> p : a.action_params) {
78 std::cout <<
"\t\t" << p.first <<
":" << p.second << std::endl;
virtual const char * what_no_backtrace() const
Get primary string (does not implicitly print the back trace).
Exception thrown by the parser if an error occurs during parsing.
static Domain parseDomain(const std::string pddl_domain)
Parse the PDDL domain.
A structured representation of a PDDL domain.
std::vector< Action > actions
A list of actions defined in the domain.
std::string name
The name of the domain.
pairs_multi_consts constants
A typed list of constants defined in the domain.
pairs_type types
A list of types with their super types.
std::vector< predicate_type > predicates
A list of predicate names in the domain, including the types of their arguments.
std::vector< std::string > requirements
A list of PDDL features required by the domain.