-
Notifications
You must be signed in to change notification settings - Fork 3
/
basicCppExample.cpp
51 lines (43 loc) · 1.27 KB
/
basicCppExample.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
#include <string>
#include <cassert>
#include "termpose.cpp"
using namespace termpose;
using namespace termpose::parsingDSL;
using namespace std;
void processApplication(Term& v){
assert(checkBool(v.findSubTerm("knows_javascript")));
Term& knowsCpp = v.findTerm("knows_C++");
assert(checkBool(knowsCpp.listContents().at(1)));
Term* passionSpecification = v.seekTerm("passion");
if(!passionSpecification){
cout<< "well that's alright ¯\\_(ツ)_/¯. You don't necessarily need that" <<endl;
}else{
if(passionSpecification->seekTerm("delusions") != nullptr){
cout<< "You're going to have to let go of those thoughts. Let us help you" <<endl;
}else{
if(checkString(passionSpecification->findSubTerm("legacy")) == "eternal"){
cout<< "your position is assured. You will be appointed as an arbiter of style" <<endl;
}else{
cout<< "requires further processing." <<endl;
}
}
}
}
int main(){
Term firstApplicant(Term::parse("\n\
applicant\n\
knows_javascript true\n\
knows_C++ true\n\
passion\n\
delusions messianic\n\
legacy eternal"
));
Term secondApplicant = terms(
"applicant",
terms("knows_javascript", "true"),
terms("knows_C++", "true")
);
processApplication(firstApplicant);
processApplication(secondApplicant);
return 0;
}