-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathForall.cpp
78 lines (58 loc) · 1.54 KB
/
Forall.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "Domain.h"
void Forall::PDDLPrint( std::ostream & s, unsigned indent, const TokenStruct< std::string > & ts, Domain & d ) {
tabindent( s, indent );
s << "( FORALL\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 << "()";
}
if( cond1 ) { s << "\n"; cond1->PDDLPrint( s, indent + 1, fstruct, d ); }
s << "\n";
tabindent( s, indent );
s << ")";
}
void Forall::parse( Filereader & f, TokenStruct< std::string > & ts, Domain & d ) {
f.next();
f.assert( "(" );
TokenStruct< std::string > fs = f.parseTypedList( true, d.types );
params = d.convertTypes( fs.types );
TokenStruct< std::string > fstruct( ts );
fstruct.append( fs );
f.next();
f.assert( "(" );
if ( f.getChar() != ')' ) {
cond = createCondition( f, d );
cond->parse( f, fstruct, d );
}
else ++f.c;
f.next();
f.assert( ")" );
}
void Forall::SHOPparse( Filereader & f, TokenStruct< std::string > & ts, Domain & d ) {
f.next();
f.assert( "(" );
TokenStruct< std::string > fs = f.parseTypedList( false );
params = d.convertTypes( fs.types );
TokenStruct< std::string > fstruct( ts );
fstruct.append( fs );
f.next();
f.assert( "(" );
if ( f.getChar() != ')' ) {
cond = new And;
cond->SHOPparse( f, fstruct, d );
}
else ++f.c;
f.next();
f.assert( "(" );
if ( f.getChar() != ')' ) {
cond1 = new And;
cond1->SHOPparse( f, fstruct, d );
}
else ++f.c;
f.next();
f.assert( ")" );
}