-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathExists.cpp
43 lines (33 loc) · 915 Bytes
/
Exists.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "Domain.h"
void Exists::PDDLPrint( std::ostream & s, unsigned indent, const TokenStruct< std::string > & ts, Domain & d ) {
tabindent( s, indent );
s << "( EXISTS\n";
TokenStruct< std::string > fstruct( ts );
tabindent( s, indent + 1 );
printParams( 0, s, fstruct, d );
if ( cond ) cond->PDDLPrint( s, indent + 1, fstruct, d );
else {
tabindent( s, indent + 1 );
s << "()";
}
s << "\n";
tabindent( s, indent );
s << ")";
}
void Exists::parse( Filereader & f, TokenStruct< std::string > & ts, Domain & d ) {
f.next();
f.assert( "(" );
TokenStruct< std::string > es = f.parseTypedList( true, d.types );
params = d.convertTypes( es.types );
TokenStruct< std::string > estruct( ts );
estruct.append( es );
f.next();
f.assert( "(" );
if ( f.getChar() != ')' ) {
cond = createCondition( f, d );
cond->parse( f, estruct, d );
}
else ++f.c;
f.next();
f.assert( ")" );
}