-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathNot.cpp
48 lines (36 loc) · 1007 Bytes
/
Not.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
#include "Domain.h"
void Not::PDDLPrint( std::ostream & s, unsigned indent, const TokenStruct< std::string > & ts, Domain & d ) {
tabindent( s, indent );
s << "( NOT ";
if ( cond ) cond->PDDLPrint( s, 0, ts, d );
s << " )";
}
void Not::parse( Filereader & f, TokenStruct< std::string > & ts, Domain & d ) {
f.next();
f.assert( "(" );
std::string s = f.getToken();
int i = d.preds.index( s );
if ( s == "=" ) cond = new Equals;
else if ( i < 0 ) f.tokenExit( s );
else cond = new Ground( d.preds[i] );
cond->parse( f, ts, d );
f.next();
f.assert( ")" );
}
void Not::SHOPparse( Filereader & f, TokenStruct< std::string > & ts, Domain & d ) {
f.next();
f.assert( "(" );
std::string s = f.getToken();
int i = d.preds.index( s );
if ( s == "=" ) cond = new Equals;
else if ( i < 0 )
{
Lifted * c = new Lifted( s );
i = d.preds.insert( c );
cond = new Ground( s );
}
else cond = new Ground( d.preds[i] );
cond->SHOPparse( f, ts, d );
f.next();
f.assert( ")" );
}