-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtestCPPTermpose.cpp
181 lines (148 loc) · 4.72 KB
/
testCPPTermpose.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#include "termpose.cpp"
using namespace termpose;
#include <string>
#include <cassert>
#include <sstream>
using namespace std;
using namespace termpose::parsingDSL;
struct v2{
float x;
float y;
};
int main(){
auto printBothWays = [](Term const& t){
cout<<t.toString()<<endl;
cout<<t.prettyPrint()<<endl;
};
// string st("hogsmouth(heme heme)");
// Term t(Term::parse(st));
// printBothWays(t);
// string termposeString("\n\
// memories\n\
// \"anthropolage\"\"\n\
// when everyone gets scattered\n\
// occulse\"\n\
// gleaming hero, shining light, greatest matron");
// Term btt = Term::parse(termposeString);
// printBothWays(btt);
// string multilineString("\n\
// memori\n\
// bogbobog\n\
// dabado\n\
// belebe\n\
// todoro\"mogodeseseseseseseseseseses somaro domese domadega damaramomo\n\
// medebe");
// t = Term::parse(multilineString);
// printBothWays(t);
// unordered_map<string,string> mems =
// mapConversion(taggedSequence(
// "memories",
// pairTrans(stringTrans(),stringTrans())
// ))->check(Term::parse(termposeString));
// string mstrs("\
// multistrings\n\
// multiString ba 90\n\
// multiString bo 90\n\
// multiString obab 45");
// Term mstt = Term::parse(mstrs);
// cout<<mstt.prettyPrint()<<endl;
// auto multiString = sliceOffTag("multiString", combineCheck([](string s, int n){
// stringstream ss;
// for(int i=0; i<n; ++i){
// ss << s;
// }
// return ss.str();
// }, stringCheck(), intCheck()));
// auto multiStringChecker = sliceOffTag("multistrings", sequenceTrans(multiString));
// vector<string> multiStrings = multiStringChecker->check(mstt);
// for(auto s : multiStrings){
// cout<< s <<endl;
// }
// auto vecTranslator = sliceOffTag("vec", combineTrans(
// [](float x, float y){ return v2{x,y}; },
// [](v2 v){ return make_tuple(v.x, v.y); },
// floatTrans(), floatTrans()));
// cout<< vecTranslator->termify(v2{1,1}).prettyPrint() <<endl;
// Term vecTerm = terms("vec","2","2");
// v2 ovec = vecTranslator->check(vecTerm);
// cout<<"vec("<<ovec.x<<" "<<ovec.y<<")"<<endl;
// Term magog = terms("magog", terms("isa", "spider"));
// assert(magog.startsWith("magog"));
// Term magag;
// magag = move(magog);
// cout<<"magag:"<<magag.initialString()<<" magog:"<<magog.initialString()<<endl;
// Term structure(Term::parse("\n\
// application\n\
// knows_javascript true\n\
// knows_C++ true\n\
// passion\n\
// delusions messianic\n\
// legacy eternal"));
// assert(checkBool(structure.findSubTerm("knows_javascript")));
// Term& knowsCpp = structure.findTerm("knows_C++");
// assert(checkBool(knowsCpp.listContents().at(1)));
// Term* passionSpecification = structure.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 the final arbiter of style" <<endl;
// }else{
// cout<< "requires further processing." <<endl;
// }
// {
// Term a = "strterm";
// Term b = vector<Term>{"on", "bo", "den"};
// Term c = terms("on", "bo", terms("dell", "brook", "ringing glass"));
// }
// {
// Term a = Term::parse("a(b)(b)");
// cout<<"it'sa "<<a.toString()<<endl;
// assert(a.toString() == "((a b) b)");
// }
// {
// Term a = Term::parse("(a b):a");
// cout<<"it's "<<a.toString()<<endl;
// assert(a.toString() == "((a b) a)");
// }
// {
// Term a = Term::parseMultiline(
// "mainModes physical\n\
// cfgModes faunEntry (conf (scroll 0))\n\
// backgroundModes background\n");
// cout<<"it's "<<a.toString()<<endl;
// assert(a.toString() == "((mainModes physical) (cfgModes faunEntry (conf (scroll 0))) (backgroundModes background))");
// }
// {
// Term a = Term::parseMultiline("\
// a `\"\n\
// b\n\
// c\n\
// d\n\
// e\n\
// d\n\
// e\n"
// );
// cout<<"it's "<<a.toString()<<endl;
// assert(a.toString() == "((a (` \"b\\n\\tc\\n\\t\\td\\n\\t\\t\\te\\n\\t\\td\")) e)");
// }
{
Term a = Term::parseMultiline(
"substate ParentBeing\n\
creatingNode `\"\n\
if(playerBody){\n\
v2 pp = playerBody->getPos();\n\
for(int i=1; i<5; ++i){\n\
options.emplace_back({toString(i), [this, modi](){\n\
vector<Term>& dialogueStateList = getCurrentDialogueMode().listContents();\n\
}});\n\
}asdfiojsdofij\n\
modi->setDialogueAnswers(move(options));\n\
}\n\
creatingNodeAddingSupply `\"\n\
modi->setDialogue(\"energy supply?\");");
cout<<"did it work, "<<a.toString()<<endl;
}
return 0;
}