1 /++
2 This module was automatically generated from the following grammar:
3 
4 BasicElements : 
5     String <~ doublequote (!doublequote Char)* doublequote
6     Numeric <- Scientific / Floating / Integer / Hexa
7     QualifiedIdentifier <- identifier ( :"." identifier)*
8 
9     Char   <~ backslash ( doublequote  # '\' Escapes
10                         / quote
11                         / backslash
12                         / [bfnrt]
13                         / [0-2][0-7][0-7]
14                         / [0-7][0-7]?
15                         / 'x' Hex Hex
16                         / 'u' Hex Hex Hex Hex
17                         / 'U' Hex Hex Hex Hex Hex Hex Hex Hex
18                         )
19              / . # Or any char, really
20     Hex     <- [0-9a-fA-F]
21 
22     Scientific <~ Floating ( ('e' / 'E' ) Integer )?
23     Floating   <~ Integer ('.' Unsigned )?
24     Unsigned   <~ [0-9]+
25     Integer    <~ Sign? Unsigned
26     Hexa       <~ [0-9a-fA-F]+
27     Sign       <- '-' / '+'
28     Bool       <- "true" / "false"
29 
30 
31 
32 +/
33 module metad.gen.grammar.elements;
34 
35 public import pegged.peg;
36 import std.algorithm: startsWith;
37 import std.functional: toDelegate;
38 
39 struct GenericBasicElements(TParseTree)
40 {
41     import std.functional : toDelegate;
42     import pegged.dynamic.grammar;
43     static import pegged.peg;
44     struct BasicElements
45     {
46     enum name = "BasicElements";
47     static ParseTree delegate(ParseTree)[string] before;
48     static ParseTree delegate(ParseTree)[string] after;
49     static ParseTree delegate(ParseTree)[string] rules;
50     import std.typecons:Tuple, tuple;
51     static TParseTree[Tuple!(string, size_t)] memo;
52     static this()
53     {
54         rules["String"] = toDelegate(&String);
55         rules["Numeric"] = toDelegate(&Numeric);
56         rules["QualifiedIdentifier"] = toDelegate(&QualifiedIdentifier);
57         rules["Char"] = toDelegate(&Char);
58         rules["Hex"] = toDelegate(&Hex);
59         rules["Scientific"] = toDelegate(&Scientific);
60         rules["Floating"] = toDelegate(&Floating);
61         rules["Unsigned"] = toDelegate(&Unsigned);
62         rules["Integer"] = toDelegate(&Integer);
63         rules["Hexa"] = toDelegate(&Hexa);
64         rules["Sign"] = toDelegate(&Sign);
65         rules["Bool"] = toDelegate(&Bool);
66         rules["Spacing"] = toDelegate(&Spacing);
67     }
68 
69     template hooked(alias r, string name)
70     {
71         static ParseTree hooked(ParseTree p)
72         {
73             ParseTree result;
74 
75             if (name in before)
76             {
77                 result = before[name](p);
78                 if (result.successful)
79                     return result;
80             }
81 
82             result = r(p);
83             if (result.successful || name !in after)
84                 return result;
85 
86             result = after[name](p);
87             return result;
88         }
89 
90         static ParseTree hooked(string input)
91         {
92             return hooked!(r, name)(ParseTree("",false,[],input));
93         }
94     }
95 
96     static void addRuleBefore(string parentRule, string ruleSyntax)
97     {
98         // enum name is the current grammar name
99         DynamicGrammar dg = pegged.dynamic.grammar.grammar(name ~ ": " ~ ruleSyntax, rules);
100         foreach(ruleName,rule; dg.rules)
101             if (ruleName != "Spacing") // Keep the local Spacing rule, do not overwrite it
102                 rules[ruleName] = rule;
103         before[parentRule] = rules[dg.startingRule];
104     }
105 
106     static void addRuleAfter(string parentRule, string ruleSyntax)
107     {
108         // enum name is the current grammar named
109         DynamicGrammar dg = pegged.dynamic.grammar.grammar(name ~ ": " ~ ruleSyntax, rules);
110         foreach(name,rule; dg.rules)
111         {
112             if (name != "Spacing")
113                 rules[name] = rule;
114         }
115         after[parentRule] = rules[dg.startingRule];
116     }
117 
118     static bool isRule(string s)
119     {
120 		import std.algorithm : startsWith;
121         return s.startsWith("BasicElements.");
122     }
123     mixin decimateTree;
124 
125     alias spacing Spacing;
126 
127     static TParseTree String(TParseTree p)
128     {
129         if(__ctfe)
130         {
131             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(doublequote, pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(doublequote), Char)), doublequote)), "BasicElements.String")(p);
132         }
133         else
134         {
135             if (auto m = tuple(`String`, p.end) in memo)
136                 return *m;
137             else
138             {
139                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(doublequote, pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(doublequote), Char)), doublequote)), "BasicElements.String"), "String")(p);
140                 memo[tuple(`String`, p.end)] = result;
141                 return result;
142             }
143         }
144     }
145 
146     static TParseTree String(string s)
147     {
148         if(__ctfe)
149         {
150             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(doublequote, pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(doublequote), Char)), doublequote)), "BasicElements.String")(TParseTree("", false,[], s));
151         }
152         else
153         {
154             forgetMemo();
155             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(doublequote, pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(doublequote), Char)), doublequote)), "BasicElements.String"), "String")(TParseTree("", false,[], s));
156         }
157     }
158     static string String(GetName g)
159     {
160         return "BasicElements.String";
161     }
162 
163     static TParseTree Numeric(TParseTree p)
164     {
165         if(__ctfe)
166         {
167             return         pegged.peg.defined!(pegged.peg.or!(Scientific, Floating, Integer, Hexa), "BasicElements.Numeric")(p);
168         }
169         else
170         {
171             if (auto m = tuple(`Numeric`, p.end) in memo)
172                 return *m;
173             else
174             {
175                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.or!(Scientific, Floating, Integer, Hexa), "BasicElements.Numeric"), "Numeric")(p);
176                 memo[tuple(`Numeric`, p.end)] = result;
177                 return result;
178             }
179         }
180     }
181 
182     static TParseTree Numeric(string s)
183     {
184         if(__ctfe)
185         {
186             return         pegged.peg.defined!(pegged.peg.or!(Scientific, Floating, Integer, Hexa), "BasicElements.Numeric")(TParseTree("", false,[], s));
187         }
188         else
189         {
190             forgetMemo();
191             return hooked!(pegged.peg.defined!(pegged.peg.or!(Scientific, Floating, Integer, Hexa), "BasicElements.Numeric"), "Numeric")(TParseTree("", false,[], s));
192         }
193     }
194     static string Numeric(GetName g)
195     {
196         return "BasicElements.Numeric";
197     }
198 
199     static TParseTree QualifiedIdentifier(TParseTree p)
200     {
201         if(__ctfe)
202         {
203             return         pegged.peg.defined!(pegged.peg.and!(identifier, pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!(".")), identifier))), "BasicElements.QualifiedIdentifier")(p);
204         }
205         else
206         {
207             if (auto m = tuple(`QualifiedIdentifier`, p.end) in memo)
208                 return *m;
209             else
210             {
211                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.and!(identifier, pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!(".")), identifier))), "BasicElements.QualifiedIdentifier"), "QualifiedIdentifier")(p);
212                 memo[tuple(`QualifiedIdentifier`, p.end)] = result;
213                 return result;
214             }
215         }
216     }
217 
218     static TParseTree QualifiedIdentifier(string s)
219     {
220         if(__ctfe)
221         {
222             return         pegged.peg.defined!(pegged.peg.and!(identifier, pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!(".")), identifier))), "BasicElements.QualifiedIdentifier")(TParseTree("", false,[], s));
223         }
224         else
225         {
226             forgetMemo();
227             return hooked!(pegged.peg.defined!(pegged.peg.and!(identifier, pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!(".")), identifier))), "BasicElements.QualifiedIdentifier"), "QualifiedIdentifier")(TParseTree("", false,[], s));
228         }
229     }
230     static string QualifiedIdentifier(GetName g)
231     {
232         return "BasicElements.QualifiedIdentifier";
233     }
234 
235     static TParseTree Char(TParseTree p)
236     {
237         if(__ctfe)
238         {
239             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(pegged.peg.and!(backslash, pegged.peg.or!(doublequote, quote, 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!(pegged.peg.charRange!('0', '2'), pegged.peg.charRange!('0', '7'), pegged.peg.charRange!('0', '7')), pegged.peg.and!(pegged.peg.charRange!('0', '7'), pegged.peg.option!(pegged.peg.charRange!('0', '7'))), pegged.peg.and!(pegged.peg.literal!("x"), Hex, Hex), pegged.peg.and!(pegged.peg.literal!("u"), Hex, Hex, Hex, Hex), pegged.peg.and!(pegged.peg.literal!("U"), Hex, Hex, Hex, Hex, Hex, Hex, Hex, Hex))), pegged.peg.any)), "BasicElements.Char")(p);
240         }
241         else
242         {
243             if (auto m = tuple(`Char`, p.end) in memo)
244                 return *m;
245             else
246             {
247                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(pegged.peg.and!(backslash, pegged.peg.or!(doublequote, quote, 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!(pegged.peg.charRange!('0', '2'), pegged.peg.charRange!('0', '7'), pegged.peg.charRange!('0', '7')), pegged.peg.and!(pegged.peg.charRange!('0', '7'), pegged.peg.option!(pegged.peg.charRange!('0', '7'))), pegged.peg.and!(pegged.peg.literal!("x"), Hex, Hex), pegged.peg.and!(pegged.peg.literal!("u"), Hex, Hex, Hex, Hex), pegged.peg.and!(pegged.peg.literal!("U"), Hex, Hex, Hex, Hex, Hex, Hex, Hex, Hex))), pegged.peg.any)), "BasicElements.Char"), "Char")(p);
248                 memo[tuple(`Char`, p.end)] = result;
249                 return result;
250             }
251         }
252     }
253 
254     static TParseTree Char(string s)
255     {
256         if(__ctfe)
257         {
258             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(pegged.peg.and!(backslash, pegged.peg.or!(doublequote, quote, 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!(pegged.peg.charRange!('0', '2'), pegged.peg.charRange!('0', '7'), pegged.peg.charRange!('0', '7')), pegged.peg.and!(pegged.peg.charRange!('0', '7'), pegged.peg.option!(pegged.peg.charRange!('0', '7'))), pegged.peg.and!(pegged.peg.literal!("x"), Hex, Hex), pegged.peg.and!(pegged.peg.literal!("u"), Hex, Hex, Hex, Hex), pegged.peg.and!(pegged.peg.literal!("U"), Hex, Hex, Hex, Hex, Hex, Hex, Hex, Hex))), pegged.peg.any)), "BasicElements.Char")(TParseTree("", false,[], s));
259         }
260         else
261         {
262             forgetMemo();
263             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(pegged.peg.and!(backslash, pegged.peg.or!(doublequote, quote, 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!(pegged.peg.charRange!('0', '2'), pegged.peg.charRange!('0', '7'), pegged.peg.charRange!('0', '7')), pegged.peg.and!(pegged.peg.charRange!('0', '7'), pegged.peg.option!(pegged.peg.charRange!('0', '7'))), pegged.peg.and!(pegged.peg.literal!("x"), Hex, Hex), pegged.peg.and!(pegged.peg.literal!("u"), Hex, Hex, Hex, Hex), pegged.peg.and!(pegged.peg.literal!("U"), Hex, Hex, Hex, Hex, Hex, Hex, Hex, Hex))), pegged.peg.any)), "BasicElements.Char"), "Char")(TParseTree("", false,[], s));
264         }
265     }
266     static string Char(GetName g)
267     {
268         return "BasicElements.Char";
269     }
270 
271     static TParseTree Hex(TParseTree p)
272     {
273         if(__ctfe)
274         {
275             return         pegged.peg.defined!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('a', 'f'), pegged.peg.charRange!('A', 'F')), "BasicElements.Hex")(p);
276         }
277         else
278         {
279             if (auto m = tuple(`Hex`, p.end) in memo)
280                 return *m;
281             else
282             {
283                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('a', 'f'), pegged.peg.charRange!('A', 'F')), "BasicElements.Hex"), "Hex")(p);
284                 memo[tuple(`Hex`, p.end)] = result;
285                 return result;
286             }
287         }
288     }
289 
290     static TParseTree Hex(string s)
291     {
292         if(__ctfe)
293         {
294             return         pegged.peg.defined!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('a', 'f'), pegged.peg.charRange!('A', 'F')), "BasicElements.Hex")(TParseTree("", false,[], s));
295         }
296         else
297         {
298             forgetMemo();
299             return hooked!(pegged.peg.defined!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('a', 'f'), pegged.peg.charRange!('A', 'F')), "BasicElements.Hex"), "Hex")(TParseTree("", false,[], s));
300         }
301     }
302     static string Hex(GetName g)
303     {
304         return "BasicElements.Hex";
305     }
306 
307     static TParseTree Scientific(TParseTree p)
308     {
309         if(__ctfe)
310         {
311             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Floating, pegged.peg.option!(pegged.peg.and!(pegged.peg.keywords!("e", "E"), Integer)))), "BasicElements.Scientific")(p);
312         }
313         else
314         {
315             if (auto m = tuple(`Scientific`, p.end) in memo)
316                 return *m;
317             else
318             {
319                 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)))), "BasicElements.Scientific"), "Scientific")(p);
320                 memo[tuple(`Scientific`, p.end)] = result;
321                 return result;
322             }
323         }
324     }
325 
326     static TParseTree Scientific(string s)
327     {
328         if(__ctfe)
329         {
330             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Floating, pegged.peg.option!(pegged.peg.and!(pegged.peg.keywords!("e", "E"), Integer)))), "BasicElements.Scientific")(TParseTree("", false,[], s));
331         }
332         else
333         {
334             forgetMemo();
335             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Floating, pegged.peg.option!(pegged.peg.and!(pegged.peg.keywords!("e", "E"), Integer)))), "BasicElements.Scientific"), "Scientific")(TParseTree("", false,[], s));
336         }
337     }
338     static string Scientific(GetName g)
339     {
340         return "BasicElements.Scientific";
341     }
342 
343     static TParseTree Floating(TParseTree p)
344     {
345         if(__ctfe)
346         {
347             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Integer, pegged.peg.option!(pegged.peg.and!(pegged.peg.literal!("."), Unsigned)))), "BasicElements.Floating")(p);
348         }
349         else
350         {
351             if (auto m = tuple(`Floating`, p.end) in memo)
352                 return *m;
353             else
354             {
355                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Integer, pegged.peg.option!(pegged.peg.and!(pegged.peg.literal!("."), Unsigned)))), "BasicElements.Floating"), "Floating")(p);
356                 memo[tuple(`Floating`, p.end)] = result;
357                 return result;
358             }
359         }
360     }
361 
362     static TParseTree Floating(string s)
363     {
364         if(__ctfe)
365         {
366             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Integer, pegged.peg.option!(pegged.peg.and!(pegged.peg.literal!("."), Unsigned)))), "BasicElements.Floating")(TParseTree("", false,[], s));
367         }
368         else
369         {
370             forgetMemo();
371             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Integer, pegged.peg.option!(pegged.peg.and!(pegged.peg.literal!("."), Unsigned)))), "BasicElements.Floating"), "Floating")(TParseTree("", false,[], s));
372         }
373     }
374     static string Floating(GetName g)
375     {
376         return "BasicElements.Floating";
377     }
378 
379     static TParseTree Unsigned(TParseTree p)
380     {
381         if(__ctfe)
382         {
383             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.charRange!('0', '9'))), "BasicElements.Unsigned")(p);
384         }
385         else
386         {
387             if (auto m = tuple(`Unsigned`, p.end) in memo)
388                 return *m;
389             else
390             {
391                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.charRange!('0', '9'))), "BasicElements.Unsigned"), "Unsigned")(p);
392                 memo[tuple(`Unsigned`, p.end)] = result;
393                 return result;
394             }
395         }
396     }
397 
398     static TParseTree Unsigned(string s)
399     {
400         if(__ctfe)
401         {
402             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.charRange!('0', '9'))), "BasicElements.Unsigned")(TParseTree("", false,[], s));
403         }
404         else
405         {
406             forgetMemo();
407             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.charRange!('0', '9'))), "BasicElements.Unsigned"), "Unsigned")(TParseTree("", false,[], s));
408         }
409     }
410     static string Unsigned(GetName g)
411     {
412         return "BasicElements.Unsigned";
413     }
414 
415     static TParseTree Integer(TParseTree p)
416     {
417         if(__ctfe)
418         {
419             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.option!(Sign), Unsigned)), "BasicElements.Integer")(p);
420         }
421         else
422         {
423             if (auto m = tuple(`Integer`, p.end) in memo)
424                 return *m;
425             else
426             {
427                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.option!(Sign), Unsigned)), "BasicElements.Integer"), "Integer")(p);
428                 memo[tuple(`Integer`, p.end)] = result;
429                 return result;
430             }
431         }
432     }
433 
434     static TParseTree Integer(string s)
435     {
436         if(__ctfe)
437         {
438             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.option!(Sign), Unsigned)), "BasicElements.Integer")(TParseTree("", false,[], s));
439         }
440         else
441         {
442             forgetMemo();
443             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.option!(Sign), Unsigned)), "BasicElements.Integer"), "Integer")(TParseTree("", false,[], s));
444         }
445     }
446     static string Integer(GetName g)
447     {
448         return "BasicElements.Integer";
449     }
450 
451     static TParseTree Hexa(TParseTree p)
452     {
453         if(__ctfe)
454         {
455             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('a', 'f'), pegged.peg.charRange!('A', 'F')))), "BasicElements.Hexa")(p);
456         }
457         else
458         {
459             if (auto m = tuple(`Hexa`, p.end) in memo)
460                 return *m;
461             else
462             {
463                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('a', 'f'), pegged.peg.charRange!('A', 'F')))), "BasicElements.Hexa"), "Hexa")(p);
464                 memo[tuple(`Hexa`, p.end)] = result;
465                 return result;
466             }
467         }
468     }
469 
470     static TParseTree Hexa(string s)
471     {
472         if(__ctfe)
473         {
474             return         pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('a', 'f'), pegged.peg.charRange!('A', 'F')))), "BasicElements.Hexa")(TParseTree("", false,[], s));
475         }
476         else
477         {
478             forgetMemo();
479             return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.or!(pegged.peg.charRange!('0', '9'), pegged.peg.charRange!('a', 'f'), pegged.peg.charRange!('A', 'F')))), "BasicElements.Hexa"), "Hexa")(TParseTree("", false,[], s));
480         }
481     }
482     static string Hexa(GetName g)
483     {
484         return "BasicElements.Hexa";
485     }
486 
487     static TParseTree Sign(TParseTree p)
488     {
489         if(__ctfe)
490         {
491             return         pegged.peg.defined!(pegged.peg.keywords!("-", "+"), "BasicElements.Sign")(p);
492         }
493         else
494         {
495             if (auto m = tuple(`Sign`, p.end) in memo)
496                 return *m;
497             else
498             {
499                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.keywords!("-", "+"), "BasicElements.Sign"), "Sign")(p);
500                 memo[tuple(`Sign`, p.end)] = result;
501                 return result;
502             }
503         }
504     }
505 
506     static TParseTree Sign(string s)
507     {
508         if(__ctfe)
509         {
510             return         pegged.peg.defined!(pegged.peg.keywords!("-", "+"), "BasicElements.Sign")(TParseTree("", false,[], s));
511         }
512         else
513         {
514             forgetMemo();
515             return hooked!(pegged.peg.defined!(pegged.peg.keywords!("-", "+"), "BasicElements.Sign"), "Sign")(TParseTree("", false,[], s));
516         }
517     }
518     static string Sign(GetName g)
519     {
520         return "BasicElements.Sign";
521     }
522 
523     static TParseTree Bool(TParseTree p)
524     {
525         if(__ctfe)
526         {
527             return         pegged.peg.defined!(pegged.peg.keywords!("true", "false"), "BasicElements.Bool")(p);
528         }
529         else
530         {
531             if (auto m = tuple(`Bool`, p.end) in memo)
532                 return *m;
533             else
534             {
535                 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.keywords!("true", "false"), "BasicElements.Bool"), "Bool")(p);
536                 memo[tuple(`Bool`, p.end)] = result;
537                 return result;
538             }
539         }
540     }
541 
542     static TParseTree Bool(string s)
543     {
544         if(__ctfe)
545         {
546             return         pegged.peg.defined!(pegged.peg.keywords!("true", "false"), "BasicElements.Bool")(TParseTree("", false,[], s));
547         }
548         else
549         {
550             forgetMemo();
551             return hooked!(pegged.peg.defined!(pegged.peg.keywords!("true", "false"), "BasicElements.Bool"), "Bool")(TParseTree("", false,[], s));
552         }
553     }
554     static string Bool(GetName g)
555     {
556         return "BasicElements.Bool";
557     }
558 
559     static TParseTree opCall(TParseTree p)
560     {
561         TParseTree result = decimateTree(String(p));
562         result.children = [result];
563         result.name = "BasicElements";
564         return result;
565     }
566 
567     static TParseTree opCall(string input)
568     {
569         if(__ctfe)
570         {
571             return BasicElements(TParseTree(``, false, [], input, 0, 0));
572         }
573         else
574         {
575             forgetMemo();
576             return BasicElements(TParseTree(``, false, [], input, 0, 0));
577         }
578     }
579     static string opCall(GetName g)
580     {
581         return "BasicElements";
582     }
583 
584 
585     static void forgetMemo()
586     {
587         memo = null;
588     }
589     }
590 }
591 
592 alias GenericBasicElements!(ParseTree).BasicElements BasicElements;
593