-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patholympus_parser.js
More file actions
13173 lines (12827 loc) · 448 KB
/
olympus_parser.js
File metadata and controls
13173 lines (12827 loc) · 448 KB
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
module.exports = /*
* Generated by PEG.js 0.10.0.
*
* http://pegjs.org/
*/
(function() {
"use strict";
function peg$subclass(child, parent) {
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor();
}
function peg$SyntaxError(message, expected, found, location) {
this.message = message;
this.expected = expected;
this.found = found;
this.location = location;
this.name = "SyntaxError";
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, peg$SyntaxError);
}
}
peg$subclass(peg$SyntaxError, Error);
peg$SyntaxError.buildMessage = function(expected, found) {
var DESCRIBE_EXPECTATION_FNS = {
literal: function(expectation) {
return "\"" + literalEscape(expectation.text) + "\"";
},
"class": function(expectation) {
var escapedParts = "",
i;
for (i = 0; i < expectation.parts.length; i++) {
escapedParts += expectation.parts[i] instanceof Array
? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
: classEscape(expectation.parts[i]);
}
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
},
any: function(expectation) {
return "any character";
},
end: function(expectation) {
return "end of input";
},
other: function(expectation) {
return expectation.description;
}
};
function hex(ch) {
return ch.charCodeAt(0).toString(16).toUpperCase();
}
function literalEscape(s) {
return s
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\0/g, '\\0')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
}
function classEscape(s) {
return s
.replace(/\\/g, '\\\\')
.replace(/\]/g, '\\]')
.replace(/\^/g, '\\^')
.replace(/-/g, '\\-')
.replace(/\0/g, '\\0')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
}
function describeExpectation(expectation) {
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
}
function describeExpected(expected) {
var descriptions = new Array(expected.length),
i, j;
for (i = 0; i < expected.length; i++) {
descriptions[i] = describeExpectation(expected[i]);
}
descriptions.sort();
if (descriptions.length > 0) {
for (i = 1, j = 1; i < descriptions.length; i++) {
if (descriptions[i - 1] !== descriptions[i]) {
descriptions[j] = descriptions[i];
j++;
}
}
descriptions.length = j;
}
switch (descriptions.length) {
case 1:
return descriptions[0];
case 2:
return descriptions[0] + " or " + descriptions[1];
default:
return descriptions.slice(0, -1).join(", ")
+ ", or "
+ descriptions[descriptions.length - 1];
}
}
function describeFound(found) {
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
}
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
};
function peg$parse(input, options) {
options = options !== void 0 ? options : {};
var peg$FAILED = {},
peg$startRuleFunctions = { Start: peg$parseStart },
peg$startRuleFunction = peg$parseStart,
peg$c0 = function(prog) {
let program = {
type: 'Program',
invocations: prog
};
return program;
},
peg$c1 = "Come, happy, deathless Gods! Hearken to my prayer!",
peg$c2 = peg$literalExpectation("Come, happy, deathless Gods! Hearken to my prayer!", false),
peg$c3 = "Come! Hear my prayer!",
peg$c4 = peg$literalExpectation("Come! Hear my prayer!", false),
peg$c5 = "O great Gods, with all the splendor of Olympus,",
peg$c6 = peg$literalExpectation("O great Gods, with all the splendor of Olympus,", false),
peg$c7 = /^[^!]/,
peg$c8 = peg$classExpectation(["!"], true, false),
peg$c9 = "!",
peg$c10 = peg$literalExpectation("!", false),
peg$c11 = "and",
peg$c12 = peg$literalExpectation("and", false),
peg$c13 = function(ad, c) {
// remove the _ and _
var requestlist = c.map(function(value,index) { return value[0]; });
if (requestlist.length > ad.epithets.length - ad.praise_factor) {
error("You ask too much of " + ad.god);
}
let requests = requestlist.map(n => n.type);
let god = ad.god;
if (DEBUG) console.log(GOD2REQUEST[god].includes(first_req));
var h = GOD2REQUEST[god].filter(value => requests.includes(value));
if (h.length < 1) {
error(`${god} is not the appropriate god for this request (${requests}), ${god} brings ${GOD2REQUEST[god]}`);
}
if (DEBUG) console.log(first_req);
if (DEBUG) console.log(god);
var cmd = {
type: 'invocation',
adoration: ad,
// cmd_count: requestlist.length,
// ept_count: ad.epithets.length,
requests: requestlist
};
return cmd;
},
peg$c14 = "please",
peg$c15 = peg$literalExpectation("please", false),
peg$c16 = ",",
peg$c17 = peg$literalExpectation(",", false),
peg$c18 = "if in the past you have looked favorably upon me",
peg$c19 = peg$literalExpectation("if in the past you have looked favorably upon me", false),
peg$c20 = "when I've been in need",
peg$c21 = peg$literalExpectation("when I've been in need", false),
peg$c22 = ", ",
peg$c23 = peg$literalExpectation(", ", false),
peg$c24 = "I ask you",
peg$c25 = peg$literalExpectation("I ask you", false),
peg$c26 = "I implore you",
peg$c27 = peg$literalExpectation("I implore you", false),
peg$c28 = "I beg you",
peg$c29 = peg$literalExpectation("I beg you", false),
peg$c30 = " to",
peg$c31 = peg$literalExpectation(" to", false),
peg$c32 = "I ask that you",
peg$c33 = peg$literalExpectation("I ask that you", false),
peg$c34 = "I beg that you",
peg$c35 = peg$literalExpectation("I beg that you", false),
peg$c36 = function() {
if (DEBUG) console.log("in Supplication");
},
peg$c37 = ".",
peg$c38 = peg$literalExpectation(".", false),
peg$c39 = ";",
peg$c40 = peg$literalExpectation(";", false),
peg$c41 = "?",
peg$c42 = peg$literalExpectation("?", false),
peg$c43 = function() {
if (DEBUG) console.log("in Pause");
},
peg$c44 = "O",
peg$c45 = peg$literalExpectation("O", false),
peg$c46 = function(g) {
if (DEBUG) console.log("in Adoration");
return g;
},
peg$c47 = "Mindful",
peg$c48 = peg$literalExpectation("Mindful", false),
peg$c49 = "Mnemosyne,",
peg$c50 = peg$literalExpectation("Mnemosyne,", false),
peg$c51 = "mistress of memory",
peg$c52 = peg$literalExpectation("mistress of memory", false),
peg$c53 = "holder of tales old and new",
peg$c54 = peg$literalExpectation("holder of tales old and new", false),
peg$c55 = "by whom the soul with intellect is joined",
peg$c56 = peg$literalExpectation("by whom the soul with intellect is joined", false),
peg$c57 = function(g, f) {
f = f.map(v => v[0]); // remove "," _
if (g) {
f = [g[0], ...f]
}
const score = score_praise(f, 2, "Mnemosyne");
return {
god: "Mnemosyne",
praise_factor: 0,
epithets: f,
adoration: score
};
},
peg$c58 = "Lord",
peg$c59 = peg$literalExpectation("Lord", false),
peg$c60 = "Zeus,",
peg$c61 = peg$literalExpectation("Zeus,", false),
peg$c62 = "who rules Olympus",
peg$c63 = peg$literalExpectation("who rules Olympus", false),
peg$c64 = "defender of cities",
peg$c65 = peg$literalExpectation("defender of cities", false),
peg$c66 = "defender of homes",
peg$c67 = peg$literalExpectation("defender of homes", false),
peg$c68 = "defender of the travelers and of those far from home",
peg$c69 = peg$literalExpectation("defender of the travelers and of those far from home", false),
peg$c70 = "master of storms",
peg$c71 = peg$literalExpectation("master of storms", false),
peg$c72 = "father of the gods",
peg$c73 = peg$literalExpectation("father of the gods", false),
peg$c74 = "of the lightning strike",
peg$c75 = peg$literalExpectation("of the lightning strike", false),
peg$c76 = "of the sturdy oak",
peg$c77 = peg$literalExpectation("of the sturdy oak", false),
peg$c78 = function(f) {
f = f.map(v => v[0]); // remove "," _
const score = score_praise(f, 4, "Zeus");
return {
god: "Zeus",
praise_factor: 3,
epithets: f,
adoration: score
};
},
peg$c79 = "Pallas",
peg$c80 = peg$literalExpectation("Pallas", false),
peg$c81 = "Clear-minded",
peg$c82 = peg$literalExpectation("Clear-minded", false),
peg$c83 = "Great and good",
peg$c84 = peg$literalExpectation("Great and good", false),
peg$c85 = "Athena",
peg$c86 = peg$literalExpectation("Athena", false),
peg$c87 = "lady of Athens",
peg$c88 = peg$literalExpectation("lady of Athens", false),
peg$c89 = "patron of heroes",
peg$c90 = peg$literalExpectation("patron of heroes", false),
peg$c91 = "of the horses",
peg$c92 = peg$literalExpectation("of the horses", false),
peg$c93 = "bestower of wisdom",
peg$c94 = peg$literalExpectation("bestower of wisdom", false),
peg$c95 = "granter of reason",
peg$c96 = peg$literalExpectation("granter of reason", false),
peg$c97 = "who hears all words spoken in market and assembly",
peg$c98 = peg$literalExpectation("who hears all words spoken in market and assembly", false),
peg$c99 = "all in brilliant armor",
peg$c100 = peg$literalExpectation("all in brilliant armor", false),
peg$c101 = "purger of evils",
peg$c102 = peg$literalExpectation("purger of evils", false),
peg$c103 = function(g, f) {
f = f.map(v => v[0]); // remove "," _
if (g) {
f = [g[0], ...f]
}
const score = score_praise(f, 4, "Athena");
return {
god: "Athena",
praise_factor: 1,
epithets: f,
adoration: score
};
},
peg$c104 = "Hades,",
peg$c105 = peg$literalExpectation("Hades,", false),
peg$c106 = "magnanimous and just",
peg$c107 = peg$literalExpectation("magnanimous and just", false),
peg$c108 = "thy realm an earthy tomb",
peg$c109 = peg$literalExpectation("thy realm an earthy tomb", false),
peg$c110 = "remote from mortals in their fleshy bust",
peg$c111 = peg$literalExpectation("remote from mortals in their fleshy bust", false),
peg$c112 = "wrapped in Kharon's watery road",
peg$c113 = peg$literalExpectation("wrapped in Kharon's watery road", false),
peg$c114 = "thy throne is fixed in the dismal plains",
peg$c115 = peg$literalExpectation("thy throne is fixed in the dismal plains", false),
peg$c116 = "unknown to most beings",
peg$c117 = peg$literalExpectation("unknown to most beings", false),
peg$c118 = "lord of the dead",
peg$c119 = peg$literalExpectation("lord of the dead", false),
peg$c120 = "lord of the dusky underworld",
peg$c121 = peg$literalExpectation("lord of the dusky underworld", false),
peg$c122 = function(f) {
f = f.map(v => v[0]); // remove "," _
const score = score_praise(f, 1, "Hades");
return {
god: "Hades",
praise_factor: 2,
epithets: f,
adoration: score
};
},
peg$c123 = "Artemis,",
peg$c124 = peg$literalExpectation("Artemis,", false),
peg$c125 = "sister of the far-shooter",
peg$c126 = peg$literalExpectation("sister of the far-shooter", false),
peg$c127 = "virgin who delights in arrows",
peg$c128 = peg$literalExpectation("virgin who delights in arrows", false),
peg$c129 = "fostered with Apollo",
peg$c130 = peg$literalExpectation("fostered with Apollo", false),
peg$c131 = "who swiftly drives her all-golden chariot through Smyrna to vine-clad Claros",
peg$c132 = peg$literalExpectation("who swiftly drives her all-golden chariot through Smyrna to vine-clad Claros", false),
peg$c133 = "far-shooting goddess",
peg$c134 = peg$literalExpectation("far-shooting goddess", false),
peg$c135 = function(f) {
f = f.map(v => v[0]); // remove "," _
const score = score_praise(f, 3, "Artemis");
return {
god: "Artemis",
praise_factor: 2,
epithets: f,
adoration: score
};
},
peg$c136 = "Ariadne,",
peg$c137 = peg$literalExpectation("Ariadne,", false),
peg$c138 = "pure one",
peg$c139 = peg$literalExpectation("pure one", false),
peg$c140 = "ancient one",
peg$c141 = peg$literalExpectation("ancient one", false),
peg$c142 = "mistress of the labyrinth",
peg$c143 = peg$literalExpectation("mistress of the labyrinth", false),
peg$c144 = "mistress of the serpent",
peg$c145 = peg$literalExpectation("mistress of the serpent", false),
peg$c146 = "wise and cunning one whose agile mind finds purchase on the frailest of notions",
peg$c147 = peg$literalExpectation("wise and cunning one whose agile mind finds purchase on the frailest of notions", false),
peg$c148 = "goddess who turns, and turns, and turns again until the way is clear",
peg$c149 = peg$literalExpectation("goddess who turns, and turns, and turns again until the way is clear", false),
peg$c150 = function(f) {
f = f.map(v => v[0]); // remove "," _
const score = score_praise(f, 3, "Ariadne");
return {
god: "Ariadne",
praise_factor: 2,
epithets: f,
adoration: score
};
},
peg$c151 = "Demeter",
peg$c152 = peg$literalExpectation("Demeter", false),
peg$c153 = "Ceres",
peg$c154 = peg$literalExpectation("Ceres", false),
peg$c155 = "goddess who grants the gift of abundance",
peg$c156 = peg$literalExpectation("goddess who grants the gift of abundance", false),
peg$c157 = "lady of the golden sword and glorious fruits",
peg$c158 = peg$literalExpectation("lady of the golden sword and glorious fruits", false),
peg$c159 = "all-bounteous",
peg$c160 = peg$literalExpectation("all-bounteous", false),
peg$c161 = "friend of the farmer",
peg$c162 = peg$literalExpectation("friend of the farmer", false),
peg$c163 = "golden-haired",
peg$c164 = peg$literalExpectation("golden-haired", false),
peg$c165 = "great lady of the land",
peg$c166 = peg$literalExpectation("great lady of the land", false),
peg$c167 = "goddess of seed",
peg$c168 = peg$literalExpectation("goddess of seed", false),
peg$c169 = "nurse of all mortals",
peg$c170 = peg$literalExpectation("nurse of all mortals", false),
peg$c171 = "bearing light",
peg$c172 = peg$literalExpectation("bearing light", false),
peg$c173 = function(n, f) {
f = f.map(v => v[0]); // remove "," _
const score = score_praise(f, 3, "Demeter");
return {
god: "Demeter",
name: n,
praise_factor: 2,
epithets: f,
adoration: score
};
},
peg$c174 = "Aphrodite,",
peg$c175 = peg$literalExpectation("Aphrodite,", false),
peg$c176 = "glory of Olympus",
peg$c177 = peg$literalExpectation("glory of Olympus", false),
peg$c178 = "golden one",
peg$c179 = peg$literalExpectation("golden one", false),
peg$c180 = "goddess of marriage",
peg$c181 = peg$literalExpectation("goddess of marriage", false),
peg$c182 = "born",
peg$c183 = peg$literalExpectation("born", false),
peg$c184 = "e",
peg$c185 = peg$literalExpectation("e", false),
peg$c186 = "of seaform",
peg$c187 = peg$literalExpectation("of seaform", false),
peg$c188 = "on the ocean's waves",
peg$c189 = peg$literalExpectation("on the ocean's waves", false),
peg$c190 = "your beauty by god or mortal unseen",
peg$c191 = peg$literalExpectation("your beauty by god or mortal unseen", false),
peg$c192 = "your power over heart and mind unknown",
peg$c193 = peg$literalExpectation("your power over heart and mind unknown", false),
peg$c194 = "who sees the truth within us",
peg$c195 = peg$literalExpectation("who sees the truth within us", false),
peg$c196 = "source of pursuation",
peg$c197 = peg$literalExpectation("source of pursuation", false),
peg$c198 = "blessed one",
peg$c199 = peg$literalExpectation("blessed one", false),
peg$c200 = "who holds us close",
peg$c201 = peg$literalExpectation("who holds us close", false),
peg$c202 = "freshest of Olympus's flowers",
peg$c203 = peg$literalExpectation("freshest of Olympus's flowers", false),
peg$c204 = function(f) {
f = f.map(v => v[0]); // remove "," _
const score = score_praise(f, 4, "Aphrodite");
return {
god: "Aphrodite",
praise_factor: 3,
epithets: f,
adoration: score
};
},
peg$c205 = "Great",
peg$c206 = peg$literalExpectation("Great", false),
peg$c207 = "Cyllenian",
peg$c208 = peg$literalExpectation("Cyllenian", false),
peg$c209 = "Hermes",
peg$c210 = peg$literalExpectation("Hermes", false),
peg$c211 = "lord of Cyllene and Arcadia rich in flocks",
peg$c212 = peg$literalExpectation("lord of Cyllene and Arcadia rich in flocks", false),
peg$c213 = "whom Maia bare",
peg$c214 = peg$literalExpectation("whom Maia bare", false),
peg$c215 = "son of Zeus",
peg$c216 = peg$literalExpectation("son of Zeus", false),
peg$c217 = "luck-bringing messenger of the deathless god",
peg$c218 = peg$literalExpectation("luck-bringing messenger of the deathless god", false),
peg$c219 = "messenger of Olympus",
peg$c220 = peg$literalExpectation("messenger of Olympus", false),
peg$c221 = "the Slayer of Argus",
peg$c222 = peg$literalExpectation("the Slayer of Argus", false),
peg$c223 = "giver of grace",
peg$c224 = peg$literalExpectation("giver of grace", false),
peg$c225 = "giver of good things",
peg$c226 = peg$literalExpectation("giver of good things", false),
peg$c227 = function(n, f) {
f = f.map(v => v[0]); // remove "," _
const score = score_praise(f, 2, "Hermes");
return {
god: "Hermes",
praise_factor: 1,
name: n,
epithets: f,
adoration: score
};
},
peg$c228 = "Ares",
peg$c229 = peg$literalExpectation("Ares", false),
peg$c230 = "Mars",
peg$c231 = peg$literalExpectation("Mars", false),
peg$c232 = "courageous one",
peg$c233 = peg$literalExpectation("courageous one", false),
peg$c234 = "well-honored in Thrace and in Scythia",
peg$c235 = peg$literalExpectation("well-honored in Thrace and in Scythia", false),
peg$c236 = "strong of arm",
peg$c237 = peg$literalExpectation("strong of arm", false),
peg$c238 = "quick of wit",
peg$c239 = peg$literalExpectation("quick of wit", false),
peg$c240 = "magnanimus",
peg$c241 = peg$literalExpectation("magnanimus", false),
peg$c242 = "fierce and untamed",
peg$c243 = peg$literalExpectation("fierce and untamed", false),
peg$c244 = "whose miighty power can make the straongest walls from their foundations shake",
peg$c245 = peg$literalExpectation("whose miighty power can make the straongest walls from their foundations shake", false),
peg$c246 = "defiled with gore",
peg$c247 = peg$literalExpectation("defiled with gore", false),
peg$c248 = function(n, f) {
f = f.map(v => v[0]); // remove "," _
const score = score_praise(f, 3, "Ares");
return {
god: "Ares",
praise_factor: 2,
name: n,
epithets: f,
adoration: score
};
},
peg$c249 = function(cmd) {
if (DEBUG) console.log("in Request");
return cmd;
},
peg$c250 = "a",
peg$c251 = peg$literalExpectation("a", false),
peg$c252 = "call",
peg$c253 = peg$literalExpectation("call", false),
peg$c254 = "to",
peg$c255 = peg$literalExpectation("to", false),
peg$c256 = function(wh1, id, params, curriedid) {
if (DEBUG) console.log("in PartialCall");
return {
type: "call",
id: id,
params: params,
loc: wh1,
curriedid: curriedid
};
},
peg$c257 = function(wh1, id, params) {
if (DEBUG) console.log("in Call");
return {
type: "call",
id: id,
params: params,
loc: wh1
};
},
peg$c258 = "calls",
peg$c259 = peg$literalExpectation("calls", false),
peg$c260 = function(id, params) {
if (DEBUG) console.log("in Calls");
return {
type: "call",
id: id,
params: params
};
},
peg$c261 = function(k, id, params, con) {
if (DEBUG) console.log("in Declare");
return {
...k,
id: id,
params: params
}
},
peg$c262 = function(wh1, k, id, params, funcbody, con) {
if (DEBUG) console.log("in DeclareInScope First")
return {
...k,
id: id,
params: params,
loc: wh1,
funcbody: funcbody
}
},
peg$c263 = "the",
peg$c264 = peg$literalExpectation("the", false),
peg$c265 = "function",
peg$c266 = peg$literalExpectation("function", false),
peg$c267 = function(fun, k, id, params, funcbody, con) {
if (DEBUG) console.log("in DeclareInScope Second");
return {
...k,
id: id,
params: params,
loc: fun,
funcbody: funcbody
}
},
peg$c268 = function(fun, k, id, params, funcbody, con) {
if (DEBUG) console.log("in DeclareInScope Second");
if (id && id.length > 0) {
id = id[2];
}
return {
...k,
id: id,
params: params,
loc: fun,
funcbody: funcbody
}
},
peg$c269 = function(func, id) {
if (DEBUG) console.log("in AddParam");
return {
type: "add_param",
func: func,
id: id
}
},
peg$c270 = "condition",
peg$c271 = peg$literalExpectation("condition", false),
peg$c272 = "for",
peg$c273 = peg$literalExpectation("for", false),
peg$c274 = "where",
peg$c275 = peg$literalExpectation("where", false),
peg$c276 = function(id, param, exp) {
if (DEBUG) console.log("in AssignCondition");
return {
type: "assign_condition",
exp: exp,
param: param[3],
id: id
}
},
peg$c277 = "it",
peg$c278 = peg$literalExpectation("it", false),
peg$c279 = "with",
peg$c280 = peg$literalExpectation("with", false),
peg$c281 = "an",
peg$c282 = peg$literalExpectation("an", false),
peg$c283 = "value",
peg$c284 = peg$literalExpectation("value", false),
peg$c285 = "missive",
peg$c286 = peg$literalExpectation("missive", false),
peg$c287 = function(id, exp) {
if (DEBUG) console.log("in Assign");
if (id == "it") id = "<prev id>";
return {
type: "assign",
id: id,
exp: exp
};
},
peg$c288 = "print",
peg$c289 = peg$literalExpectation("print", false),
peg$c290 = "s",
peg$c291 = peg$literalExpectation("s", false),
peg$c292 = function(wh1, exp) {
if (DEBUG) console.log("in Print");
return {
type: "print",
exp: exp,
loc: wh1
};
},
peg$c293 = "return",
peg$c294 = peg$literalExpectation("return", false),
peg$c295 = function(wh1, exp) {
if (DEBUG) console.log("in Return");
return {
type: "return",
exp: exp,
loc: wh1
};
},
peg$c296 = "eval",
peg$c297 = peg$literalExpectation("eval", false),
peg$c298 = function(wh1, exp) {
if (DEBUG) console.log("in Eval");
return {
type: "return",
exp: exp,
loc: wh1
};
},
peg$c299 = "collect all variables that remain, stranded in the functions of Chion or in the main sequence to live on in your netherworld",
peg$c300 = peg$literalExpectation("collect all variables that remain, stranded in the functions of Chion or in the main sequence to live on in your netherworld", false),
peg$c301 = function() {
return {
type: "destroy",
exp: "all"
};
},
peg$c302 = "parameter",
peg$c303 = peg$literalExpectation("parameter", false),
peg$c304 = "param",
peg$c305 = peg$literalExpectation("param", false),
peg$c306 = function(id) {
if (DEBUG) console.log("in ParamName");
return id;
},
peg$c307 = "add",
peg$c308 = peg$literalExpectation("add", false),
peg$c309 = "give",
peg$c310 = peg$literalExpectation("give", false),
peg$c311 = "assign",
peg$c312 = peg$literalExpectation("assign", false),
peg$c313 = "grant",
peg$c314 = peg$literalExpectation("grant", false),
peg$c315 = "place within",
peg$c316 = peg$literalExpectation("place within", false),
peg$c317 = "inscribe",
peg$c318 = peg$literalExpectation("inscribe", false),
peg$c319 = "create",
peg$c320 = peg$literalExpectation("create", false),
peg$c321 = "establish",
peg$c322 = peg$literalExpectation("establish", false),
peg$c323 = "make",
peg$c324 = peg$literalExpectation("make", false),
peg$c325 = "produce",
peg$c326 = peg$literalExpectation("produce", false),
peg$c327 = "name",
peg$c328 = peg$literalExpectation("name", false),
peg$c329 = function() { if (DEBUG) console.log("in Name"); },
peg$c330 = "named",
peg$c331 = peg$literalExpectation("named", false),
peg$c332 = "called",
peg$c333 = peg$literalExpectation("called", false),
peg$c334 = function() { if (DEBUG) console.log("in Named"); },
peg$c335 = function(w, id) {
if (DEBUG) console.log("in Where");
return {
"type":w,
"name":id
};
},
peg$c336 = "at the beginning of",
peg$c337 = peg$literalExpectation("at the beginning of", false),
peg$c338 = "at the start of",
peg$c339 = peg$literalExpectation("at the start of", false),
peg$c340 = "at the top of",
peg$c341 = peg$literalExpectation("at the top of", false),
peg$c342 = function() { return "start" },
peg$c343 = "inside",
peg$c344 = peg$literalExpectation("inside", false),
peg$c345 = "within",
peg$c346 = peg$literalExpectation("within", false),
peg$c347 = function() { return "inside"; },
peg$c348 = "that",
peg$c349 = peg$literalExpectation("that", false),
peg$c350 = "has",
peg$c351 = peg$literalExpectation("has", false),
peg$c352 = " and ",
peg$c353 = peg$literalExpectation(" and ", false),
peg$c354 = function(params) {
if (DEBUG) console.log("in GetParams");
params = params.map(f => (
{
type: "param_name",
name: f[0]
}
));
return params;
},
peg$c355 = "loop",
peg$c356 = peg$literalExpectation("loop", false),
peg$c357 = "counting",
peg$c358 = peg$literalExpectation("counting", false),
peg$c359 = "from",
peg$c360 = peg$literalExpectation("from", false),
peg$c361 = function(start, end) {
if (DEBUG) console.log("in ForLoop");
return {
type: "for",
start: start,
end: end
}
},
peg$c362 = function() {
if (DEBUG) console.log("in Function");
return {
type: "function"
}
},
peg$c363 = "vessel",
peg$c364 = peg$literalExpectation("vessel", false),
peg$c365 = function() {
if (DEBUG) console.log("in Var");
return {
type: "var"
}
},
peg$c366 = "check",
peg$c367 = peg$literalExpectation("check", false),
peg$c368 = function() {
if (DEBUG) console.log("in If");
return {
type: "check"
}
},
peg$c369 = function(id, prams) {
if (DEBUG) console.log("in CallDirectObject");
return {
type: "call"
}
},
peg$c370 = ", and",
peg$c371 = peg$literalExpectation(", and", false),
peg$c372 = function(exp, explist) {
if (DEBUG) console.log("in Expression");
if (explist != null) {
explist = explist[3];
console.log(explist);
}
if (explist != null) {
console.log([exp].concat(explist));
return [exp].concat(explist);
} else {
console.log(exp);
return exp;
}
},
peg$c373 = "(",
peg$c374 = peg$literalExpectation("(", false),
peg$c375 = ")",
peg$c376 = peg$literalExpectation(")", false),
peg$c377 = function(exp) {
if (DEBUG) console.log("in ExpressionBlock");
return {
type: "ExpressionBlock",
expression: exp
};
},
peg$c378 = function(left, op, right) {
if (DEBUG) console.log("in Comparison");
return {
type: "Comparison",
operator: op,
left: left,
right: right
};
},
peg$c379 = "is equal to",
peg$c380 = peg$literalExpectation("is equal to", false),
peg$c381 = "equals",
peg$c382 = peg$literalExpectation("equals", false),
peg$c383 = function() { return "=="; },
peg$c384 = "is not equal to",
peg$c385 = peg$literalExpectation("is not equal to", false),
peg$c386 = "is differant from",
peg$c387 = peg$literalExpectation("is differant from", false),
peg$c388 = "is not",
peg$c389 = peg$literalExpectation("is not", false),
peg$c390 = function() { return "!="; },
peg$c391 = "is greater than",
peg$c392 = peg$literalExpectation("is greater than", false),
peg$c393 = "is more than",
peg$c394 = peg$literalExpectation("is more than", false),
peg$c395 = function() { return ">"; },
peg$c396 = "is less than",
peg$c397 = peg$literalExpectation("is less than", false),
peg$c398 = "is fewer than",
peg$c399 = peg$literalExpectation("is fewer than", false),
peg$c400 = function() { return "<"; },
peg$c401 = "is less than or equal to",
peg$c402 = peg$literalExpectation("is less than or equal to", false),
peg$c403 = "is less than or the same as",
peg$c404 = peg$literalExpectation("is less than or the same as", false),
peg$c405 = function() { return "<="; },
peg$c406 = "is greater than or equal to",
peg$c407 = peg$literalExpectation("is greater than or equal to", false),
peg$c408 = "is more than or the same as",
peg$c409 = peg$literalExpectation("is more than or the same as", false),
peg$c410 = function() { return ">="; },
peg$c411 = function(left, op, right) {
if (DEBUG) console.log("in AdditiveExpression");
return {
type: "Additive",
operator: op,
left: left,
right: right
};
},
peg$c412 = "T",
peg$c413 = peg$literalExpectation("T", false),
peg$c414 = "t",
peg$c415 = peg$literalExpectation("t", false),
peg$c416 = "he",
peg$c417 = peg$literalExpectation("he", false),
peg$c418 = "of",
peg$c419 = peg$literalExpectation("of", false),
peg$c420 = function(op, left, right) {
if (DEBUG) console.log("in AdditiveExpression DirectObject");
return {
type: "Additive",
operator: op,
left: left,
right: right
};
},
peg$c421 = function(left, op, right) {
if (DEBUG) console.log("in MultiplicativeExpression");
return {
type: "Multiplicative",
operator: op,
left: left,
right: right
};
},
peg$c422 = function(op, left, right) {
if (DEBUG) console.log("in MultiplicativeExpression DirectObject");
return {
type: "Multiplicative",
operator: op,
left: left,
right: right
};
},
peg$c423 = "plus",
peg$c424 = peg$literalExpectation("plus", false),
peg$c425 = function() { return "+"; },
peg$c426 = "sum",
peg$c427 = peg$literalExpectation("sum", false),
peg$c428 = "minus",
peg$c429 = peg$literalExpectation("minus", false),
peg$c430 = function() { return "-"; },
peg$c431 = "difference",
peg$c432 = peg$literalExpectation("difference", false),
peg$c433 = "times",
peg$c434 = peg$literalExpectation("times", false),
peg$c435 = function() { return "*"; },
peg$c436 = "product",
peg$c437 = peg$literalExpectation("product", false),
peg$c438 = "divided by",
peg$c439 = peg$literalExpectation("divided by", false),
peg$c440 = function() { return "/"; },
peg$c441 = "quotient",
peg$c442 = peg$literalExpectation("quotient", false),
peg$c443 = "modulo",
peg$c444 = peg$literalExpectation("modulo", false),
peg$c445 = function() { return "%"; },
peg$c446 = "modulus",
peg$c447 = peg$literalExpectation("modulus", false),
peg$c448 = function(g) {
return g;
},
peg$c449 = "variable",
peg$c450 = peg$literalExpectation("variable", false),
peg$c451 = "var",
peg$c452 = peg$literalExpectation("var", false),
peg$c453 = function(id) {
if (DEBUG) console.log("in VariableName");
return {
type: "VariableName",
name: id
};
},
peg$c454 = function(mil, thou, hun, end) {
if (DEBUG) console.log("in NumberLiteral Millions");
let retval = mil;
if (thou) retval += thou;
if (hun) retval += hun;
if (end) retval += end;
return { type: "IntLiteral", value: retval };
},
peg$c455 = function(thou, hun, end) {
if (DEBUG) console.log("in NumberLiteral Thousands");
let retval = thou;