1 /++
2 This module was automatically generated from the following grammar:
3 
4 Terminals:
5 
6 
7 
8 Literal < ^String / ^Number / Boolean / ^Null
9 
10 
11 
12 String <~ :doublequote Char* :doublequote
13 
14 
15 
16 Char   <~ backslash doublequote
17 
18           / backslash backslash
19 
20           / backslash [bfnrt]
21 
22           / backslash 'x' Hex Hex
23 
24           / backslash 'u' Hex Hex Hex Hex
25 
26           / backslash 'U' Hex Hex Hex Hex Hex Hex Hex Hex
27 
28           / (!doublequote .)
29 
30 
31 
32 Hex    <- [0-9A-Fa-f]
33 
34 
35 
36 
37 
38 Number <~ Scientific / Floating / Integer / Hexa / Binary
39 
40 
41 
42 Scientific <~ Floating ( ('e' / 'E' ) Integer )?
43 
44 Floating   <~ Integer ('.' Unsigned )?
45 
46 Unsigned   <~ [0-9]+
47 
48 Integer    <~ Sign? Unsigned
49 
50 Hexa       <~ :"0x"[0-9a-fA-F]+
51 
52 Binary     <~ :"0b" [01] [01_]*
53 
54 Sign       <- '-' / '+'
55 
56 
57 
58 Boolean <- ^True / ^False
59 
60 
61 
62 True   <- "true"
63 
64 False  <- "false"
65 
66 
67 
68 Null   <- "null"
69 
70 
71 
72 +/
73 module coregrammars.gen.terms;
74 
75 public import pegged.peg;
76 import std.algorithm: startsWith;
77 import std.functional: toDelegate;
78 
79 struct GenericTerminals(TParseTree)
80 {
81     import std.functional : toDelegate;
82     import pegged.dynamic.grammar;
83     static import pegged.peg;
84     struct Terminals
85     {
86     enum name = "Terminals";
87     static ParseTree delegate(ParseTree)[string] before;
88     static ParseTree delegate(ParseTree)[string] after;
89     static ParseTree delegate(ParseTree)[string] rules;
90     import std.typecons:Tuple, tuple;
91     static TParseTree[Tuple!(string, size_t)] memo;
92     static this()
93     {
94         rules["Literal"] = toDelegate(&Literal);
95         rules["String"] = toDelegate(&String);
96         rules["Char"] = toDelegate(&Char);
97         rules["Hex"] = toDelegate(&Hex);
98         rules["Number"] = toDelegate(&Number);
99         rules["Scientific"] = toDelegate(&Scientific);
100         rules["Floating"] = toDelegate(&Floating);
101         rules["Unsigned"] = toDelegate(&Unsigned);
102         rules["Integer"] = toDelegate(&Integer);
103         rules["Hexa"] = toDelegate(&Hexa);
104         rules["Binary"] = toDelegate(&Binary);
105         rules["Sign"] = toDelegate(&Sign);
106         rules["Boolean"] = toDelegate(&Boolean);
107         rules["True"] = toDelegate(&True);
108         rules["False"] = toDelegate(&False);
109         rules["Null"] = toDelegate(&Null);
110         rules["Spacing"] = toDelegate(&Spacing);
111     }
112 
113     template hooked(alias r, string name)
114     {
115         static ParseTree hooked(ParseTree p)
116         {
117             ParseTree result;
118 
119             if (name in before)
120             {
121                 result = before[name](p);
122                 if (result.successful)
123                     return result;
124             }
125 
126             result = r(p);
127             if (result.successful || name !in after)
128                 return result;
129 
130             result = after[name](p);
131             return result;
132         }
133 
134         static ParseTree hooked(string input)
135         {
136             return hooked!(r, name)(ParseTree("",false,[],input));
137         }
138     }
139 
140     static void addRuleBefore(string parentRule, string ruleSyntax)
141     {
142         // enum name is the current grammar name
143         DynamicGrammar dg = pegged.dynamic.grammar.grammar(name ~ ": " ~ ruleSyntax, rules);
144         foreach(ruleName,rule; dg.rules)
145             if (ruleName != "Spacing") // Keep the local Spacing rule, do not overwrite it
146                 rules[ruleName] = rule;
147         before[parentRule] = rules[dg.startingRule];
148     }
149 
150     static void addRuleAfter(string parentRule, string ruleSyntax)
151     {
152         // enum name is the current grammar named
153         DynamicGrammar dg = pegged.dynamic.grammar.grammar(name ~ ": " ~ ruleSyntax, rules);
154         foreach(ruleName,rule; dg.rules)
155         {
156             if (ruleName != "Spacing")
157                 rules[ruleName] = rule;
158         }
159         after[parentRule] = rules[dg.startingRule];
160     }
161 
162     static bool isRule(string s)
163     {
164         import std.algorithm : startsWith;
165         return s.startsWith("Terminals.");
166     }
167     mixin decimateTree;
168 
169     alias spacing Spacing;
170 
171     static TParseTree Literal(TParseTree p)
172     {
173         if(__ctfe)
174         {
175             return         pegged.peg.defined!(pegged.peg.or!(pegged.peg.keep!(pegged.peg.wrapAround!(Spacing, String, Spacing)), pegged.peg.keep!(pegged.peg.wrapAround!(Spacing, Number, Spacing)), pegged.peg.wrapAround!(Spacing, Boolean, Spacing), pegged.peg.keep!(pegged.peg.wrapAround!(Spacing, Null, Spacing))), "Terminals.Literal")(p);
176         }
177         else
178         {
179             if (auto m = tuple(`Literal`, p.end) in memo)
180                 return *m;
181             else
182             {
183                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.or!(pegged.peg.keep!(pegged.peg.wrapAround!(Spacing, String, Spacing)), pegged.peg.keep!(pegged.peg.wrapAround!(Spacing, Number, Spacing)), pegged.peg.wrapAround!(Spacing, Boolean, Spacing), pegged.peg.keep!(pegged.peg.wrapAround!(Spacing, Null, Spacing))), "Terminals.Literal"), "Literal")(p);
184                 memo[tuple(`Literal`, p.end)] = result;
185                 return result;
186             }
187         }
188     }
189 
190     static TParseTree Literal(string s)
191     {
192         if(__ctfe)
193         {
194             return         pegged.peg.defined!(pegged.peg.or!(pegged.peg.keep!(pegged.peg.wrapAround!(Spacing, String, Spacing)), pegged.peg.keep!(pegged.peg.wrapAround!(Spacing, Number, Spacing)), pegged.peg.wrapAround!(Spacing, Boolean, Spacing), pegged.peg.keep!(pegged.peg.wrapAround!(Spacing, Null, Spacing))), "Terminals.Literal")(TParseTree("", false,[], s));
195         }
196         else
197         {
198             forgetMemo();
199             return hooked!(pegged.peg.defined!(pegged.peg.or!(pegged.peg.keep!(pegged.peg.wrapAround!(Spacing, String, Spacing)), pegged.peg.keep!(pegged.peg.wrapAround!(Spacing, Number, Spacing)), pegged.peg.wrapAround!(Spacing, Boolean, Spacing), pegged.peg.keep!(pegged.peg.wrapAround!(Spacing, Null, Spacing))), "Terminals.Literal"), "Literal")(TParseTree("", false,[], s));
200         }
201     }
202     static string Literal(GetName g)
203     {
204         return "Terminals.Literal";
205     }
206 
207     static TParseTree String(TParseTree p)
208     {
209         if(__ctfe)
210         {
211             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.discard!(doublequote), pegged.peg.zeroOrMore!(Char), pegged.peg.discard!(doublequote))), "Terminals.String")(p);
212         }
213         else
214         {
215             if (auto m = tuple(`String`, p.end) in memo)
216                 return *m;
217             else
218             {
219                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.discard!(doublequote), pegged.peg.zeroOrMore!(Char), pegged.peg.discard!(doublequote))), "Terminals.String"), "String")(p);
220                 memo[tuple(`String`, p.end)] = result;
221                 return result;
222             }
223         }
224     }
225 
226     static TParseTree String(string s)
227     {
228         if(__ctfe)
229         {
230             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.discard!(doublequote), pegged.peg.zeroOrMore!(Char), pegged.peg.discard!(doublequote))), "Terminals.String")(TParseTree("", false,[], s));
231         }
232         else
233         {
234             forgetMemo();
235             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.discard!(doublequote), pegged.peg.zeroOrMore!(Char), pegged.peg.discard!(doublequote))), "Terminals.String"), "String")(TParseTree("", false,[], s));
236         }
237     }
238     static string String(GetName g)
239     {
240         return "Terminals.String";
241     }
242 
243     static TParseTree Char(TParseTree p)
244     {
245         if(__ctfe)
246         {
247             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(pegged.peg.and!(backslash, doublequote), pegged.peg.and!(backslash, backslash), pegged.peg.and!(backslash, pegged.peg.or!(pegged.peg.literal!("b"), pegged.peg.literal!("f"), pegged.peg.literal!("n"), pegged.peg.literal!("r"), pegged.peg.literal!("t"))), pegged.peg.and!(backslash, pegged.peg.literal!("x"), Hex, Hex), pegged.peg.and!(backslash, pegged.peg.literal!("u"), Hex, Hex, Hex, Hex), pegged.peg.and!(backslash, pegged.peg.literal!("U"), Hex, Hex, Hex, Hex, Hex, Hex, Hex, Hex), pegged.peg.and!(pegged.peg.negLookahead!(doublequote), pegged.peg.any))), "Terminals.Char")(p);
248         }
249         else
250         {
251             if (auto m = tuple(`Char`, p.end) in memo)
252                 return *m;
253             else
254             {
255                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(pegged.peg.and!(backslash, doublequote), pegged.peg.and!(backslash, backslash), pegged.peg.and!(backslash, pegged.peg.or!(pegged.peg.literal!("b"), pegged.peg.literal!("f"), pegged.peg.literal!("n"), pegged.peg.literal!("r"), pegged.peg.literal!("t"))), pegged.peg.and!(backslash, pegged.peg.literal!("x"), Hex, Hex), pegged.peg.and!(backslash, pegged.peg.literal!("u"), Hex, Hex, Hex, Hex), pegged.peg.and!(backslash, pegged.peg.literal!("U"), Hex, Hex, Hex, Hex, Hex, Hex, Hex, Hex), pegged.peg.and!(pegged.peg.negLookahead!(doublequote), pegged.peg.any))), "Terminals.Char"), "Char")(p);
256                 memo[tuple(`Char`, p.end)] = result;
257                 return result;
258             }
259         }
260     }
261 
262     static TParseTree Char(string s)
263     {
264         if(__ctfe)
265         {
266             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(pegged.peg.and!(backslash, doublequote), pegged.peg.and!(backslash, backslash), pegged.peg.and!(backslash, pegged.peg.or!(pegged.peg.literal!("b"), pegged.peg.literal!("f"), pegged.peg.literal!("n"), pegged.peg.literal!("r"), pegged.peg.literal!("t"))), pegged.peg.and!(backslash, pegged.peg.literal!("x"), Hex, Hex), pegged.peg.and!(backslash, pegged.peg.literal!("u"), Hex, Hex, Hex, Hex), pegged.peg.and!(backslash, pegged.peg.literal!("U"), Hex, Hex, Hex, Hex, Hex, Hex, Hex, Hex), pegged.peg.and!(pegged.peg.negLookahead!(doublequote), pegged.peg.any))), "Terminals.Char")(TParseTree("", false,[], s));
267         }
268         else
269         {
270             forgetMemo();
271             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(pegged.peg.and!(backslash, doublequote), pegged.peg.and!(backslash, backslash), pegged.peg.and!(backslash, pegged.peg.or!(pegged.peg.literal!("b"), pegged.peg.literal!("f"), pegged.peg.literal!("n"), pegged.peg.literal!("r"), pegged.peg.literal!("t"))), pegged.peg.and!(backslash, pegged.peg.literal!("x"), Hex, Hex), pegged.peg.and!(backslash, pegged.peg.literal!("u"), Hex, Hex, Hex, Hex), pegged.peg.and!(backslash, pegged.peg.literal!("U"), Hex, Hex, Hex, Hex, Hex, Hex, Hex, Hex), pegged.peg.and!(pegged.peg.negLookahead!(doublequote), pegged.peg.any))), "Terminals.Char"), "Char")(TParseTree("", false,[], s));
272         }
273     }
274     static string Char(GetName g)
275     {
276         return "Terminals.Char";
277     }
278 
279     static TParseTree Hex(TParseTree p)
280     {
281         if(__ctfe)
282         {
283             return         pegged.peg.defined!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('A', 'F'), pegged.peg.charRange!('a', 'f')), "Terminals.Hex")(p);
284         }
285         else
286         {
287             if (auto m = tuple(`Hex`, p.end) in memo)
288                 return *m;
289             else
290             {
291                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('A', 'F'), pegged.peg.charRange!('a', 'f')), "Terminals.Hex"), "Hex")(p);
292                 memo[tuple(`Hex`, p.end)] = result;
293                 return result;
294             }
295         }
296     }
297 
298     static TParseTree Hex(string s)
299     {
300         if(__ctfe)
301         {
302             return         pegged.peg.defined!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('A', 'F'), pegged.peg.charRange!('a', 'f')), "Terminals.Hex")(TParseTree("", false,[], s));
303         }
304         else
305         {
306             forgetMemo();
307             return hooked!(pegged.peg.defined!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('A', 'F'), pegged.peg.charRange!('a', 'f')), "Terminals.Hex"), "Hex")(TParseTree("", false,[], s));
308         }
309     }
310     static string Hex(GetName g)
311     {
312         return "Terminals.Hex";
313     }
314 
315     static TParseTree Number(TParseTree p)
316     {
317         if(__ctfe)
318         {
319             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(Scientific, Floating, Integer, Hexa, Binary)), "Terminals.Number")(p);
320         }
321         else
322         {
323             if (auto m = tuple(`Number`, p.end) in memo)
324                 return *m;
325             else
326             {
327                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(Scientific, Floating, Integer, Hexa, Binary)), "Terminals.Number"), "Number")(p);
328                 memo[tuple(`Number`, p.end)] = result;
329                 return result;
330             }
331         }
332     }
333 
334     static TParseTree Number(string s)
335     {
336         if(__ctfe)
337         {
338             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(Scientific, Floating, Integer, Hexa, Binary)), "Terminals.Number")(TParseTree("", false,[], s));
339         }
340         else
341         {
342             forgetMemo();
343             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(Scientific, Floating, Integer, Hexa, Binary)), "Terminals.Number"), "Number")(TParseTree("", false,[], s));
344         }
345     }
346     static string Number(GetName g)
347     {
348         return "Terminals.Number";
349     }
350 
351     static TParseTree Scientific(TParseTree p)
352     {
353         if(__ctfe)
354         {
355             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Floating, pegged.peg.option!(pegged.peg.and!(pegged.peg.keywords!("e", "E"), Integer)))), "Terminals.Scientific")(p);
356         }
357         else
358         {
359             if (auto m = tuple(`Scientific`, p.end) in memo)
360                 return *m;
361             else
362             {
363                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Floating, pegged.peg.option!(pegged.peg.and!(pegged.peg.keywords!("e", "E"), Integer)))), "Terminals.Scientific"), "Scientific")(p);
364                 memo[tuple(`Scientific`, p.end)] = result;
365                 return result;
366             }
367         }
368     }
369 
370     static TParseTree Scientific(string s)
371     {
372         if(__ctfe)
373         {
374             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Floating, pegged.peg.option!(pegged.peg.and!(pegged.peg.keywords!("e", "E"), Integer)))), "Terminals.Scientific")(TParseTree("", false,[], s));
375         }
376         else
377         {
378             forgetMemo();
379             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Floating, pegged.peg.option!(pegged.peg.and!(pegged.peg.keywords!("e", "E"), Integer)))), "Terminals.Scientific"), "Scientific")(TParseTree("", false,[], s));
380         }
381     }
382     static string Scientific(GetName g)
383     {
384         return "Terminals.Scientific";
385     }
386 
387     static TParseTree Floating(TParseTree p)
388     {
389         if(__ctfe)
390         {
391             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Integer, pegged.peg.option!(pegged.peg.and!(pegged.peg.literal!("."), Unsigned)))), "Terminals.Floating")(p);
392         }
393         else
394         {
395             if (auto m = tuple(`Floating`, p.end) in memo)
396                 return *m;
397             else
398             {
399                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Integer, pegged.peg.option!(pegged.peg.and!(pegged.peg.literal!("."), Unsigned)))), "Terminals.Floating"), "Floating")(p);
400                 memo[tuple(`Floating`, p.end)] = result;
401                 return result;
402             }
403         }
404     }
405 
406     static TParseTree Floating(string s)
407     {
408         if(__ctfe)
409         {
410             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Integer, pegged.peg.option!(pegged.peg.and!(pegged.peg.literal!("."), Unsigned)))), "Terminals.Floating")(TParseTree("", false,[], s));
411         }
412         else
413         {
414             forgetMemo();
415             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Integer, pegged.peg.option!(pegged.peg.and!(pegged.peg.literal!("."), Unsigned)))), "Terminals.Floating"), "Floating")(TParseTree("", false,[], s));
416         }
417     }
418     static string Floating(GetName g)
419     {
420         return "Terminals.Floating";
421     }
422 
423     static TParseTree Unsigned(TParseTree p)
424     {
425         if(__ctfe)
426         {
427             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.charRange!('0', '9'))), "Terminals.Unsigned")(p);
428         }
429         else
430         {
431             if (auto m = tuple(`Unsigned`, p.end) in memo)
432                 return *m;
433             else
434             {
435                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.charRange!('0', '9'))), "Terminals.Unsigned"), "Unsigned")(p);
436                 memo[tuple(`Unsigned`, p.end)] = result;
437                 return result;
438             }
439         }
440     }
441 
442     static TParseTree Unsigned(string s)
443     {
444         if(__ctfe)
445         {
446             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.charRange!('0', '9'))), "Terminals.Unsigned")(TParseTree("", false,[], s));
447         }
448         else
449         {
450             forgetMemo();
451             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.charRange!('0', '9'))), "Terminals.Unsigned"), "Unsigned")(TParseTree("", false,[], s));
452         }
453     }
454     static string Unsigned(GetName g)
455     {
456         return "Terminals.Unsigned";
457     }
458 
459     static TParseTree Integer(TParseTree p)
460     {
461         if(__ctfe)
462         {
463             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.option!(Sign), Unsigned)), "Terminals.Integer")(p);
464         }
465         else
466         {
467             if (auto m = tuple(`Integer`, p.end) in memo)
468                 return *m;
469             else
470             {
471                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.option!(Sign), Unsigned)), "Terminals.Integer"), "Integer")(p);
472                 memo[tuple(`Integer`, p.end)] = result;
473                 return result;
474             }
475         }
476     }
477 
478     static TParseTree Integer(string s)
479     {
480         if(__ctfe)
481         {
482             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.option!(Sign), Unsigned)), "Terminals.Integer")(TParseTree("", false,[], s));
483         }
484         else
485         {
486             forgetMemo();
487             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.option!(Sign), Unsigned)), "Terminals.Integer"), "Integer")(TParseTree("", false,[], s));
488         }
489     }
490     static string Integer(GetName g)
491     {
492         return "Terminals.Integer";
493     }
494 
495     static TParseTree Hexa(TParseTree p)
496     {
497         if(__ctfe)
498         {
499             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!("0x")), pegged.peg.oneOrMore!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('a', 'f'), pegged.peg.charRange!('A', 'F'))))), "Terminals.Hexa")(p);
500         }
501         else
502         {
503             if (auto m = tuple(`Hexa`, p.end) in memo)
504                 return *m;
505             else
506             {
507                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!("0x")), pegged.peg.oneOrMore!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('a', 'f'), pegged.peg.charRange!('A', 'F'))))), "Terminals.Hexa"), "Hexa")(p);
508                 memo[tuple(`Hexa`, p.end)] = result;
509                 return result;
510             }
511         }
512     }
513 
514     static TParseTree Hexa(string s)
515     {
516         if(__ctfe)
517         {
518             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!("0x")), pegged.peg.oneOrMore!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('a', 'f'), pegged.peg.charRange!('A', 'F'))))), "Terminals.Hexa")(TParseTree("", false,[], s));
519         }
520         else
521         {
522             forgetMemo();
523             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!("0x")), pegged.peg.oneOrMore!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('a', 'f'), pegged.peg.charRange!('A', 'F'))))), "Terminals.Hexa"), "Hexa")(TParseTree("", false,[], s));
524         }
525     }
526     static string Hexa(GetName g)
527     {
528         return "Terminals.Hexa";
529     }
530 
531     static TParseTree Binary(TParseTree p)
532     {
533         if(__ctfe)
534         {
535             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!("0b")), pegged.peg.or!(pegged.peg.literal!("0"), pegged.peg.literal!("1")), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.literal!("0"), pegged.peg.literal!("1"), pegged.peg.literal!("_"))))), "Terminals.Binary")(p);
536         }
537         else
538         {
539             if (auto m = tuple(`Binary`, p.end) in memo)
540                 return *m;
541             else
542             {
543                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!("0b")), pegged.peg.or!(pegged.peg.literal!("0"), pegged.peg.literal!("1")), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.literal!("0"), pegged.peg.literal!("1"), pegged.peg.literal!("_"))))), "Terminals.Binary"), "Binary")(p);
544                 memo[tuple(`Binary`, p.end)] = result;
545                 return result;
546             }
547         }
548     }
549 
550     static TParseTree Binary(string s)
551     {
552         if(__ctfe)
553         {
554             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!("0b")), pegged.peg.or!(pegged.peg.literal!("0"), pegged.peg.literal!("1")), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.literal!("0"), pegged.peg.literal!("1"), pegged.peg.literal!("_"))))), "Terminals.Binary")(TParseTree("", false,[], s));
555         }
556         else
557         {
558             forgetMemo();
559             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!("0b")), pegged.peg.or!(pegged.peg.literal!("0"), pegged.peg.literal!("1")), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.literal!("0"), pegged.peg.literal!("1"), pegged.peg.literal!("_"))))), "Terminals.Binary"), "Binary")(TParseTree("", false,[], s));
560         }
561     }
562     static string Binary(GetName g)
563     {
564         return "Terminals.Binary";
565     }
566 
567     static TParseTree Sign(TParseTree p)
568     {
569         if(__ctfe)
570         {
571             return         pegged.peg.defined!(pegged.peg.keywords!("-", "+"), "Terminals.Sign")(p);
572         }
573         else
574         {
575             if (auto m = tuple(`Sign`, p.end) in memo)
576                 return *m;
577             else
578             {
579                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.keywords!("-", "+"), "Terminals.Sign"), "Sign")(p);
580                 memo[tuple(`Sign`, p.end)] = result;
581                 return result;
582             }
583         }
584     }
585 
586     static TParseTree Sign(string s)
587     {
588         if(__ctfe)
589         {
590             return         pegged.peg.defined!(pegged.peg.keywords!("-", "+"), "Terminals.Sign")(TParseTree("", false,[], s));
591         }
592         else
593         {
594             forgetMemo();
595             return hooked!(pegged.peg.defined!(pegged.peg.keywords!("-", "+"), "Terminals.Sign"), "Sign")(TParseTree("", false,[], s));
596         }
597     }
598     static string Sign(GetName g)
599     {
600         return "Terminals.Sign";
601     }
602 
603     static TParseTree Boolean(TParseTree p)
604     {
605         if(__ctfe)
606         {
607             return         pegged.peg.defined!(pegged.peg.or!(pegged.peg.keep!(True), pegged.peg.keep!(False)), "Terminals.Boolean")(p);
608         }
609         else
610         {
611             if (auto m = tuple(`Boolean`, p.end) in memo)
612                 return *m;
613             else
614             {
615                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.or!(pegged.peg.keep!(True), pegged.peg.keep!(False)), "Terminals.Boolean"), "Boolean")(p);
616                 memo[tuple(`Boolean`, p.end)] = result;
617                 return result;
618             }
619         }
620     }
621 
622     static TParseTree Boolean(string s)
623     {
624         if(__ctfe)
625         {
626             return         pegged.peg.defined!(pegged.peg.or!(pegged.peg.keep!(True), pegged.peg.keep!(False)), "Terminals.Boolean")(TParseTree("", false,[], s));
627         }
628         else
629         {
630             forgetMemo();
631             return hooked!(pegged.peg.defined!(pegged.peg.or!(pegged.peg.keep!(True), pegged.peg.keep!(False)), "Terminals.Boolean"), "Boolean")(TParseTree("", false,[], s));
632         }
633     }
634     static string Boolean(GetName g)
635     {
636         return "Terminals.Boolean";
637     }
638 
639     static TParseTree True(TParseTree p)
640     {
641         if(__ctfe)
642         {
643             return         pegged.peg.defined!(pegged.peg.literal!("true"), "Terminals.True")(p);
644         }
645         else
646         {
647             if (auto m = tuple(`True`, p.end) in memo)
648                 return *m;
649             else
650             {
651                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.literal!("true"), "Terminals.True"), "True")(p);
652                 memo[tuple(`True`, p.end)] = result;
653                 return result;
654             }
655         }
656     }
657 
658     static TParseTree True(string s)
659     {
660         if(__ctfe)
661         {
662             return         pegged.peg.defined!(pegged.peg.literal!("true"), "Terminals.True")(TParseTree("", false,[], s));
663         }
664         else
665         {
666             forgetMemo();
667             return hooked!(pegged.peg.defined!(pegged.peg.literal!("true"), "Terminals.True"), "True")(TParseTree("", false,[], s));
668         }
669     }
670     static string True(GetName g)
671     {
672         return "Terminals.True";
673     }
674 
675     static TParseTree False(TParseTree p)
676     {
677         if(__ctfe)
678         {
679             return         pegged.peg.defined!(pegged.peg.literal!("false"), "Terminals.False")(p);
680         }
681         else
682         {
683             if (auto m = tuple(`False`, p.end) in memo)
684                 return *m;
685             else
686             {
687                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.literal!("false"), "Terminals.False"), "False")(p);
688                 memo[tuple(`False`, p.end)] = result;
689                 return result;
690             }
691         }
692     }
693 
694     static TParseTree False(string s)
695     {
696         if(__ctfe)
697         {
698             return         pegged.peg.defined!(pegged.peg.literal!("false"), "Terminals.False")(TParseTree("", false,[], s));
699         }
700         else
701         {
702             forgetMemo();
703             return hooked!(pegged.peg.defined!(pegged.peg.literal!("false"), "Terminals.False"), "False")(TParseTree("", false,[], s));
704         }
705     }
706     static string False(GetName g)
707     {
708         return "Terminals.False";
709     }
710 
711     static TParseTree Null(TParseTree p)
712     {
713         if(__ctfe)
714         {
715             return         pegged.peg.defined!(pegged.peg.literal!("null"), "Terminals.Null")(p);
716         }
717         else
718         {
719             if (auto m = tuple(`Null`, p.end) in memo)
720                 return *m;
721             else
722             {
723                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.literal!("null"), "Terminals.Null"), "Null")(p);
724                 memo[tuple(`Null`, p.end)] = result;
725                 return result;
726             }
727         }
728     }
729 
730     static TParseTree Null(string s)
731     {
732         if(__ctfe)
733         {
734             return         pegged.peg.defined!(pegged.peg.literal!("null"), "Terminals.Null")(TParseTree("", false,[], s));
735         }
736         else
737         {
738             forgetMemo();
739             return hooked!(pegged.peg.defined!(pegged.peg.literal!("null"), "Terminals.Null"), "Null")(TParseTree("", false,[], s));
740         }
741     }
742     static string Null(GetName g)
743     {
744         return "Terminals.Null";
745     }
746 
747     static TParseTree opCall(TParseTree p)
748     {
749         TParseTree result = decimateTree(Literal(p));
750         result.children = [result];
751         result.name = "Terminals";
752         return result;
753     }
754 
755     static TParseTree opCall(string input)
756     {
757         if(__ctfe)
758         {
759             return Terminals(TParseTree(``, false, [], input, 0, 0));
760         }
761         else
762         {
763             forgetMemo();
764             return Terminals(TParseTree(``, false, [], input, 0, 0));
765         }
766     }
767     static string opCall(GetName g)
768     {
769         return "Terminals";
770     }
771 
772 
773     static void forgetMemo()
774     {
775         memo = null;
776     }
777     }
778 }
779 
780 alias GenericTerminals!(ParseTree).Terminals Terminals;
781