1 /++ 2 This module was automatically generated from the following grammar: 3 4 SDL: 5 TagTree <- Line* 6 Line < Tag (:';' Tag)* :EOL 7 Tag < (Value / TagName) (Value :Spacing)* (Attribute Spacing)* (:'{' :EOL TagTree :'}')? 8 9 TagName <- ;Namespace? ~([a-z][a-zA-Z0-9_.$\-]*)? 10 AttrName <- ~([a-zA-Z0-9_]+) 11 Namespace <- ~([a-z][a-zA-Z0-9_.$\-]*)? :':' 12 13 Value <- String / DateTime / Duration / Float / Number / Base64 / Boolean / Null 14 Attribute <- AttrName :'=' Value 15 16 String <~ :doublequote (:backslash doublequote / !doublequote !endOfLine .)* :doublequote 17 / :backquote (!backquote !endOfLine .)* :backquote 18 DateTime < Date Time? 19 Date <~ Digit Digit Digit Digit :'/' Digit Digit :'/' Digit Digit 20 Time <- ~(Digit Digit :':' Digit Digit :':' Digit Digit) :'.' ~(Digit Digit Digit) UTC? 21 Duration <- ~(Digit+ 'd' :':')? ~(Digit Digit :':' Digit Digit :':' Digit Digit) ~('.' Digit Digit Digit)? 22 Number <~ Digit+ ('L' / 'BD')? 23 Float <~ Digit+ '.' Digit+ 'f'? 24 Boolean <- "true" / "false" / "on" / "off" 25 Null <- "null" 26 Base64 <- :'[' ~(([a-zA-Z+0-9/] / :Spacing)*) :']' 27 UTC <- "-UTC" 28 29 Digit <- [0-9] 30 Char <- !doublequote !endOfLine . / backslash doublequote 31 Spacing <- BlockComment / backslash endOfLine / :(' ' / '\t')* 32 EOL <: endOfLine / LineComment 33 34 LineComment <- :("//" / "--" / "#") (!endOfLine .)* endOfLine 35 BlockComment <- "/*" (!"*/" .)* "*/" 36 37 38 +/ 39 module sdlangp.grammar; 40 41 public import pegged.peg; 42 import std.algorithm: startsWith; 43 import std.functional: toDelegate; 44 45 struct GenericSDL(TParseTree) 46 { 47 import std.functional : toDelegate; 48 import pegged.dynamic.grammar; 49 static import pegged.peg; 50 struct SDL 51 { 52 enum name = "SDL"; 53 static ParseTree delegate(ParseTree)[string] before; 54 static ParseTree delegate(ParseTree)[string] after; 55 static ParseTree delegate(ParseTree)[string] rules; 56 import std.typecons:Tuple, tuple; 57 static TParseTree[Tuple!(string, size_t)] memo; 58 static this() 59 { 60 rules["TagTree"] = toDelegate(&TagTree); 61 rules["Line"] = toDelegate(&Line); 62 rules["Tag"] = toDelegate(&Tag); 63 rules["TagName"] = toDelegate(&TagName); 64 rules["AttrName"] = toDelegate(&AttrName); 65 rules["Namespace"] = toDelegate(&Namespace); 66 rules["Value"] = toDelegate(&Value); 67 rules["Attribute"] = toDelegate(&Attribute); 68 rules["String"] = toDelegate(&String); 69 rules["DateTime"] = toDelegate(&DateTime); 70 rules["Date"] = toDelegate(&Date); 71 rules["Time"] = toDelegate(&Time); 72 rules["Duration"] = toDelegate(&Duration); 73 rules["Number"] = toDelegate(&Number); 74 rules["Float"] = toDelegate(&Float); 75 rules["Boolean"] = toDelegate(&Boolean); 76 rules["Null"] = toDelegate(&Null); 77 rules["Base64"] = toDelegate(&Base64); 78 rules["UTC"] = toDelegate(&UTC); 79 rules["Digit"] = toDelegate(&Digit); 80 rules["Char"] = toDelegate(&Char); 81 rules["Spacing"] = toDelegate(&Spacing); 82 } 83 84 template hooked(alias r, string name) 85 { 86 static ParseTree hooked(ParseTree p) 87 { 88 ParseTree result; 89 90 if (name in before) 91 { 92 result = before[name](p); 93 if (result.successful) 94 return result; 95 } 96 97 result = r(p); 98 if (result.successful || name !in after) 99 return result; 100 101 result = after[name](p); 102 return result; 103 } 104 105 static ParseTree hooked(string input) 106 { 107 return hooked!(r, name)(ParseTree("",false,[],input)); 108 } 109 } 110 111 static void addRuleBefore(string parentRule, string ruleSyntax) 112 { 113 // enum name is the current grammar name 114 DynamicGrammar dg = pegged.dynamic.grammar.grammar(name ~ ": " ~ ruleSyntax, rules); 115 foreach(ruleName,rule; dg.rules) 116 if (ruleName != "Spacing") // Keep the local Spacing rule, do not overwrite it 117 rules[ruleName] = rule; 118 before[parentRule] = rules[dg.startingRule]; 119 } 120 121 static void addRuleAfter(string parentRule, string ruleSyntax) 122 { 123 // enum name is the current grammar named 124 DynamicGrammar dg = pegged.dynamic.grammar.grammar(name ~ ": " ~ ruleSyntax, rules); 125 foreach(name,rule; dg.rules) 126 { 127 if (name != "Spacing") 128 rules[name] = rule; 129 } 130 after[parentRule] = rules[dg.startingRule]; 131 } 132 133 static bool isRule(string s) 134 { 135 import std.algorithm : startsWith; 136 return s.startsWith("SDL."); 137 } 138 mixin decimateTree; 139 140 static TParseTree TagTree(TParseTree p) 141 { 142 if(__ctfe) 143 { 144 return pegged.peg.defined!(pegged.peg.zeroOrMore!(Line), "SDL.TagTree")(p); 145 } 146 else 147 { 148 if (auto m = tuple(`TagTree`, p.end) in memo) 149 return *m; 150 else 151 { 152 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.zeroOrMore!(Line), "SDL.TagTree"), "TagTree")(p); 153 memo[tuple(`TagTree`, p.end)] = result; 154 return result; 155 } 156 } 157 } 158 159 static TParseTree TagTree(string s) 160 { 161 if(__ctfe) 162 { 163 return pegged.peg.defined!(pegged.peg.zeroOrMore!(Line), "SDL.TagTree")(TParseTree("", false,[], s)); 164 } 165 else 166 { 167 forgetMemo(); 168 return hooked!(pegged.peg.defined!(pegged.peg.zeroOrMore!(Line), "SDL.TagTree"), "TagTree")(TParseTree("", false,[], s)); 169 } 170 } 171 static string TagTree(GetName g) 172 { 173 return "SDL.TagTree"; 174 } 175 176 static TParseTree Line(TParseTree p) 177 { 178 if(__ctfe) 179 { 180 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Tag, Spacing), pegged.peg.zeroOrMore!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, pegged.peg.literal!(";"), Spacing)), pegged.peg.wrapAround!(Spacing, Tag, Spacing)), Spacing)), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, EOL, Spacing))), "SDL.Line")(p); 181 } 182 else 183 { 184 if (auto m = tuple(`Line`, p.end) in memo) 185 return *m; 186 else 187 { 188 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Tag, Spacing), pegged.peg.zeroOrMore!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, pegged.peg.literal!(";"), Spacing)), pegged.peg.wrapAround!(Spacing, Tag, Spacing)), Spacing)), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, EOL, Spacing))), "SDL.Line"), "Line")(p); 189 memo[tuple(`Line`, p.end)] = result; 190 return result; 191 } 192 } 193 } 194 195 static TParseTree Line(string s) 196 { 197 if(__ctfe) 198 { 199 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Tag, Spacing), pegged.peg.zeroOrMore!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, pegged.peg.literal!(";"), Spacing)), pegged.peg.wrapAround!(Spacing, Tag, Spacing)), Spacing)), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, EOL, Spacing))), "SDL.Line")(TParseTree("", false,[], s)); 200 } 201 else 202 { 203 forgetMemo(); 204 return hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Tag, Spacing), pegged.peg.zeroOrMore!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, pegged.peg.literal!(";"), Spacing)), pegged.peg.wrapAround!(Spacing, Tag, Spacing)), Spacing)), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, EOL, Spacing))), "SDL.Line"), "Line")(TParseTree("", false,[], s)); 205 } 206 } 207 static string Line(GetName g) 208 { 209 return "SDL.Line"; 210 } 211 212 static TParseTree Tag(TParseTree p) 213 { 214 if(__ctfe) 215 { 216 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.wrapAround!(Spacing, pegged.peg.or!(pegged.peg.wrapAround!(Spacing, Value, Spacing), pegged.peg.wrapAround!(Spacing, TagName, Spacing)), Spacing), pegged.peg.zeroOrMore!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Value, Spacing), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, Spacing, Spacing))), Spacing)), pegged.peg.zeroOrMore!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Attribute, Spacing), pegged.peg.wrapAround!(Spacing, Spacing, Spacing)), Spacing)), pegged.peg.option!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, pegged.peg.literal!("{"), Spacing)), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, EOL, Spacing)), pegged.peg.wrapAround!(Spacing, TagTree, Spacing), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, pegged.peg.literal!("}"), Spacing))), Spacing))), "SDL.Tag")(p); 217 } 218 else 219 { 220 if (auto m = tuple(`Tag`, p.end) in memo) 221 return *m; 222 else 223 { 224 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.wrapAround!(Spacing, pegged.peg.or!(pegged.peg.wrapAround!(Spacing, Value, Spacing), pegged.peg.wrapAround!(Spacing, TagName, Spacing)), Spacing), pegged.peg.zeroOrMore!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Value, Spacing), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, Spacing, Spacing))), Spacing)), pegged.peg.zeroOrMore!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Attribute, Spacing), pegged.peg.wrapAround!(Spacing, Spacing, Spacing)), Spacing)), pegged.peg.option!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, pegged.peg.literal!("{"), Spacing)), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, EOL, Spacing)), pegged.peg.wrapAround!(Spacing, TagTree, Spacing), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, pegged.peg.literal!("}"), Spacing))), Spacing))), "SDL.Tag"), "Tag")(p); 225 memo[tuple(`Tag`, p.end)] = result; 226 return result; 227 } 228 } 229 } 230 231 static TParseTree Tag(string s) 232 { 233 if(__ctfe) 234 { 235 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.wrapAround!(Spacing, pegged.peg.or!(pegged.peg.wrapAround!(Spacing, Value, Spacing), pegged.peg.wrapAround!(Spacing, TagName, Spacing)), Spacing), pegged.peg.zeroOrMore!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Value, Spacing), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, Spacing, Spacing))), Spacing)), pegged.peg.zeroOrMore!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Attribute, Spacing), pegged.peg.wrapAround!(Spacing, Spacing, Spacing)), Spacing)), pegged.peg.option!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, pegged.peg.literal!("{"), Spacing)), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, EOL, Spacing)), pegged.peg.wrapAround!(Spacing, TagTree, Spacing), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, pegged.peg.literal!("}"), Spacing))), Spacing))), "SDL.Tag")(TParseTree("", false,[], s)); 236 } 237 else 238 { 239 forgetMemo(); 240 return hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.wrapAround!(Spacing, pegged.peg.or!(pegged.peg.wrapAround!(Spacing, Value, Spacing), pegged.peg.wrapAround!(Spacing, TagName, Spacing)), Spacing), pegged.peg.zeroOrMore!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Value, Spacing), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, Spacing, Spacing))), Spacing)), pegged.peg.zeroOrMore!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Attribute, Spacing), pegged.peg.wrapAround!(Spacing, Spacing, Spacing)), Spacing)), pegged.peg.option!(pegged.peg.wrapAround!(Spacing, pegged.peg.and!(pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, pegged.peg.literal!("{"), Spacing)), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, EOL, Spacing)), pegged.peg.wrapAround!(Spacing, TagTree, Spacing), pegged.peg.discard!(pegged.peg.wrapAround!(Spacing, pegged.peg.literal!("}"), Spacing))), Spacing))), "SDL.Tag"), "Tag")(TParseTree("", false,[], s)); 241 } 242 } 243 static string Tag(GetName g) 244 { 245 return "SDL.Tag"; 246 } 247 248 static TParseTree TagName(TParseTree p) 249 { 250 if(__ctfe) 251 { 252 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.drop!(pegged.peg.option!(Namespace)), pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.charRange!('a', 'z'), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("_"), pegged.peg.literal!("."), pegged.peg.literal!("$"), pegged.peg.literal!("-"))))))), "SDL.TagName")(p); 253 } 254 else 255 { 256 if (auto m = tuple(`TagName`, p.end) in memo) 257 return *m; 258 else 259 { 260 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.drop!(pegged.peg.option!(Namespace)), pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.charRange!('a', 'z'), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("_"), pegged.peg.literal!("."), pegged.peg.literal!("$"), pegged.peg.literal!("-"))))))), "SDL.TagName"), "TagName")(p); 261 memo[tuple(`TagName`, p.end)] = result; 262 return result; 263 } 264 } 265 } 266 267 static TParseTree TagName(string s) 268 { 269 if(__ctfe) 270 { 271 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.drop!(pegged.peg.option!(Namespace)), pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.charRange!('a', 'z'), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("_"), pegged.peg.literal!("."), pegged.peg.literal!("$"), pegged.peg.literal!("-"))))))), "SDL.TagName")(TParseTree("", false,[], s)); 272 } 273 else 274 { 275 forgetMemo(); 276 return hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.drop!(pegged.peg.option!(Namespace)), pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.charRange!('a', 'z'), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("_"), pegged.peg.literal!("."), pegged.peg.literal!("$"), pegged.peg.literal!("-"))))))), "SDL.TagName"), "TagName")(TParseTree("", false,[], s)); 277 } 278 } 279 static string TagName(GetName g) 280 { 281 return "SDL.TagName"; 282 } 283 284 static TParseTree AttrName(TParseTree p) 285 { 286 if(__ctfe) 287 { 288 return pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("_")))), "SDL.AttrName")(p); 289 } 290 else 291 { 292 if (auto m = tuple(`AttrName`, p.end) in memo) 293 return *m; 294 else 295 { 296 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("_")))), "SDL.AttrName"), "AttrName")(p); 297 memo[tuple(`AttrName`, p.end)] = result; 298 return result; 299 } 300 } 301 } 302 303 static TParseTree AttrName(string s) 304 { 305 if(__ctfe) 306 { 307 return pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("_")))), "SDL.AttrName")(TParseTree("", false,[], s)); 308 } 309 else 310 { 311 forgetMemo(); 312 return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.oneOrMore!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("_")))), "SDL.AttrName"), "AttrName")(TParseTree("", false,[], s)); 313 } 314 } 315 static string AttrName(GetName g) 316 { 317 return "SDL.AttrName"; 318 } 319 320 static TParseTree Namespace(TParseTree p) 321 { 322 if(__ctfe) 323 { 324 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.charRange!('a', 'z'), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("_"), pegged.peg.literal!("."), pegged.peg.literal!("$"), pegged.peg.literal!("-")))))), pegged.peg.discard!(pegged.peg.literal!(":"))), "SDL.Namespace")(p); 325 } 326 else 327 { 328 if (auto m = tuple(`Namespace`, p.end) in memo) 329 return *m; 330 else 331 { 332 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.charRange!('a', 'z'), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("_"), pegged.peg.literal!("."), pegged.peg.literal!("$"), pegged.peg.literal!("-")))))), pegged.peg.discard!(pegged.peg.literal!(":"))), "SDL.Namespace"), "Namespace")(p); 333 memo[tuple(`Namespace`, p.end)] = result; 334 return result; 335 } 336 } 337 } 338 339 static TParseTree Namespace(string s) 340 { 341 if(__ctfe) 342 { 343 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.charRange!('a', 'z'), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("_"), pegged.peg.literal!("."), pegged.peg.literal!("$"), pegged.peg.literal!("-")))))), pegged.peg.discard!(pegged.peg.literal!(":"))), "SDL.Namespace")(TParseTree("", false,[], s)); 344 } 345 else 346 { 347 forgetMemo(); 348 return hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.charRange!('a', 'z'), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("_"), pegged.peg.literal!("."), pegged.peg.literal!("$"), pegged.peg.literal!("-")))))), pegged.peg.discard!(pegged.peg.literal!(":"))), "SDL.Namespace"), "Namespace")(TParseTree("", false,[], s)); 349 } 350 } 351 static string Namespace(GetName g) 352 { 353 return "SDL.Namespace"; 354 } 355 356 static TParseTree Value(TParseTree p) 357 { 358 if(__ctfe) 359 { 360 return pegged.peg.defined!(pegged.peg.or!(String, DateTime, Duration, Float, Number, Base64, Boolean, Null), "SDL.Value")(p); 361 } 362 else 363 { 364 if (auto m = tuple(`Value`, p.end) in memo) 365 return *m; 366 else 367 { 368 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.or!(String, DateTime, Duration, Float, Number, Base64, Boolean, Null), "SDL.Value"), "Value")(p); 369 memo[tuple(`Value`, p.end)] = result; 370 return result; 371 } 372 } 373 } 374 375 static TParseTree Value(string s) 376 { 377 if(__ctfe) 378 { 379 return pegged.peg.defined!(pegged.peg.or!(String, DateTime, Duration, Float, Number, Base64, Boolean, Null), "SDL.Value")(TParseTree("", false,[], s)); 380 } 381 else 382 { 383 forgetMemo(); 384 return hooked!(pegged.peg.defined!(pegged.peg.or!(String, DateTime, Duration, Float, Number, Base64, Boolean, Null), "SDL.Value"), "Value")(TParseTree("", false,[], s)); 385 } 386 } 387 static string Value(GetName g) 388 { 389 return "SDL.Value"; 390 } 391 392 static TParseTree Attribute(TParseTree p) 393 { 394 if(__ctfe) 395 { 396 return pegged.peg.defined!(pegged.peg.and!(AttrName, pegged.peg.discard!(pegged.peg.literal!("=")), Value), "SDL.Attribute")(p); 397 } 398 else 399 { 400 if (auto m = tuple(`Attribute`, p.end) in memo) 401 return *m; 402 else 403 { 404 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.and!(AttrName, pegged.peg.discard!(pegged.peg.literal!("=")), Value), "SDL.Attribute"), "Attribute")(p); 405 memo[tuple(`Attribute`, p.end)] = result; 406 return result; 407 } 408 } 409 } 410 411 static TParseTree Attribute(string s) 412 { 413 if(__ctfe) 414 { 415 return pegged.peg.defined!(pegged.peg.and!(AttrName, pegged.peg.discard!(pegged.peg.literal!("=")), Value), "SDL.Attribute")(TParseTree("", false,[], s)); 416 } 417 else 418 { 419 forgetMemo(); 420 return hooked!(pegged.peg.defined!(pegged.peg.and!(AttrName, pegged.peg.discard!(pegged.peg.literal!("=")), Value), "SDL.Attribute"), "Attribute")(TParseTree("", false,[], s)); 421 } 422 } 423 static string Attribute(GetName g) 424 { 425 return "SDL.Attribute"; 426 } 427 428 static TParseTree String(TParseTree p) 429 { 430 if(__ctfe) 431 { 432 return pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(pegged.peg.and!(pegged.peg.discard!(doublequote), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.and!(pegged.peg.discard!(backslash), doublequote), pegged.peg.and!(pegged.peg.negLookahead!(doublequote), pegged.peg.negLookahead!(endOfLine), pegged.peg.any))), pegged.peg.discard!(doublequote)), pegged.peg.and!(pegged.peg.discard!(backquote), pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(backquote), pegged.peg.negLookahead!(endOfLine), pegged.peg.any)), pegged.peg.discard!(backquote)))), "SDL.String")(p); 433 } 434 else 435 { 436 if (auto m = tuple(`String`, p.end) in memo) 437 return *m; 438 else 439 { 440 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(pegged.peg.and!(pegged.peg.discard!(doublequote), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.and!(pegged.peg.discard!(backslash), doublequote), pegged.peg.and!(pegged.peg.negLookahead!(doublequote), pegged.peg.negLookahead!(endOfLine), pegged.peg.any))), pegged.peg.discard!(doublequote)), pegged.peg.and!(pegged.peg.discard!(backquote), pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(backquote), pegged.peg.negLookahead!(endOfLine), pegged.peg.any)), pegged.peg.discard!(backquote)))), "SDL.String"), "String")(p); 441 memo[tuple(`String`, p.end)] = result; 442 return result; 443 } 444 } 445 } 446 447 static TParseTree String(string s) 448 { 449 if(__ctfe) 450 { 451 return pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(pegged.peg.and!(pegged.peg.discard!(doublequote), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.and!(pegged.peg.discard!(backslash), doublequote), pegged.peg.and!(pegged.peg.negLookahead!(doublequote), pegged.peg.negLookahead!(endOfLine), pegged.peg.any))), pegged.peg.discard!(doublequote)), pegged.peg.and!(pegged.peg.discard!(backquote), pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(backquote), pegged.peg.negLookahead!(endOfLine), pegged.peg.any)), pegged.peg.discard!(backquote)))), "SDL.String")(TParseTree("", false,[], s)); 452 } 453 else 454 { 455 forgetMemo(); 456 return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.or!(pegged.peg.and!(pegged.peg.discard!(doublequote), pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.and!(pegged.peg.discard!(backslash), doublequote), pegged.peg.and!(pegged.peg.negLookahead!(doublequote), pegged.peg.negLookahead!(endOfLine), pegged.peg.any))), pegged.peg.discard!(doublequote)), pegged.peg.and!(pegged.peg.discard!(backquote), pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(backquote), pegged.peg.negLookahead!(endOfLine), pegged.peg.any)), pegged.peg.discard!(backquote)))), "SDL.String"), "String")(TParseTree("", false,[], s)); 457 } 458 } 459 static string String(GetName g) 460 { 461 return "SDL.String"; 462 } 463 464 static TParseTree DateTime(TParseTree p) 465 { 466 if(__ctfe) 467 { 468 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Date, Spacing), pegged.peg.option!(pegged.peg.wrapAround!(Spacing, Time, Spacing))), "SDL.DateTime")(p); 469 } 470 else 471 { 472 if (auto m = tuple(`DateTime`, p.end) in memo) 473 return *m; 474 else 475 { 476 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Date, Spacing), pegged.peg.option!(pegged.peg.wrapAround!(Spacing, Time, Spacing))), "SDL.DateTime"), "DateTime")(p); 477 memo[tuple(`DateTime`, p.end)] = result; 478 return result; 479 } 480 } 481 } 482 483 static TParseTree DateTime(string s) 484 { 485 if(__ctfe) 486 { 487 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Date, Spacing), pegged.peg.option!(pegged.peg.wrapAround!(Spacing, Time, Spacing))), "SDL.DateTime")(TParseTree("", false,[], s)); 488 } 489 else 490 { 491 forgetMemo(); 492 return hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.wrapAround!(Spacing, Date, Spacing), pegged.peg.option!(pegged.peg.wrapAround!(Spacing, Time, Spacing))), "SDL.DateTime"), "DateTime")(TParseTree("", false,[], s)); 493 } 494 } 495 static string DateTime(GetName g) 496 { 497 return "SDL.DateTime"; 498 } 499 500 static TParseTree Date(TParseTree p) 501 { 502 if(__ctfe) 503 { 504 return pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, Digit, Digit, pegged.peg.discard!(pegged.peg.literal!("/")), Digit, Digit, pegged.peg.discard!(pegged.peg.literal!("/")), Digit, Digit)), "SDL.Date")(p); 505 } 506 else 507 { 508 if (auto m = tuple(`Date`, p.end) in memo) 509 return *m; 510 else 511 { 512 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, Digit, Digit, pegged.peg.discard!(pegged.peg.literal!("/")), Digit, Digit, pegged.peg.discard!(pegged.peg.literal!("/")), Digit, Digit)), "SDL.Date"), "Date")(p); 513 memo[tuple(`Date`, p.end)] = result; 514 return result; 515 } 516 } 517 } 518 519 static TParseTree Date(string s) 520 { 521 if(__ctfe) 522 { 523 return pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, Digit, Digit, pegged.peg.discard!(pegged.peg.literal!("/")), Digit, Digit, pegged.peg.discard!(pegged.peg.literal!("/")), Digit, Digit)), "SDL.Date")(TParseTree("", false,[], s)); 524 } 525 else 526 { 527 forgetMemo(); 528 return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, Digit, Digit, pegged.peg.discard!(pegged.peg.literal!("/")), Digit, Digit, pegged.peg.discard!(pegged.peg.literal!("/")), Digit, Digit)), "SDL.Date"), "Date")(TParseTree("", false,[], s)); 529 } 530 } 531 static string Date(GetName g) 532 { 533 return "SDL.Date"; 534 } 535 536 static TParseTree Time(TParseTree p) 537 { 538 if(__ctfe) 539 { 540 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit)), pegged.peg.discard!(pegged.peg.literal!(".")), pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, Digit)), pegged.peg.option!(UTC)), "SDL.Time")(p); 541 } 542 else 543 { 544 if (auto m = tuple(`Time`, p.end) in memo) 545 return *m; 546 else 547 { 548 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit)), pegged.peg.discard!(pegged.peg.literal!(".")), pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, Digit)), pegged.peg.option!(UTC)), "SDL.Time"), "Time")(p); 549 memo[tuple(`Time`, p.end)] = result; 550 return result; 551 } 552 } 553 } 554 555 static TParseTree Time(string s) 556 { 557 if(__ctfe) 558 { 559 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit)), pegged.peg.discard!(pegged.peg.literal!(".")), pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, Digit)), pegged.peg.option!(UTC)), "SDL.Time")(TParseTree("", false,[], s)); 560 } 561 else 562 { 563 forgetMemo(); 564 return hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit)), pegged.peg.discard!(pegged.peg.literal!(".")), pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, Digit)), pegged.peg.option!(UTC)), "SDL.Time"), "Time")(TParseTree("", false,[], s)); 565 } 566 } 567 static string Time(GetName g) 568 { 569 return "SDL.Time"; 570 } 571 572 static TParseTree Duration(TParseTree p) 573 { 574 if(__ctfe) 575 { 576 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.oneOrMore!(Digit), pegged.peg.literal!("d"), pegged.peg.discard!(pegged.peg.literal!(":"))))), pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit)), pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.literal!("."), Digit, Digit, Digit)))), "SDL.Duration")(p); 577 } 578 else 579 { 580 if (auto m = tuple(`Duration`, p.end) in memo) 581 return *m; 582 else 583 { 584 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.oneOrMore!(Digit), pegged.peg.literal!("d"), pegged.peg.discard!(pegged.peg.literal!(":"))))), pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit)), pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.literal!("."), Digit, Digit, Digit)))), "SDL.Duration"), "Duration")(p); 585 memo[tuple(`Duration`, p.end)] = result; 586 return result; 587 } 588 } 589 } 590 591 static TParseTree Duration(string s) 592 { 593 if(__ctfe) 594 { 595 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.oneOrMore!(Digit), pegged.peg.literal!("d"), pegged.peg.discard!(pegged.peg.literal!(":"))))), pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit)), pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.literal!("."), Digit, Digit, Digit)))), "SDL.Duration")(TParseTree("", false,[], s)); 596 } 597 else 598 { 599 forgetMemo(); 600 return hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.oneOrMore!(Digit), pegged.peg.literal!("d"), pegged.peg.discard!(pegged.peg.literal!(":"))))), pegged.peg.fuse!(pegged.peg.and!(Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit, pegged.peg.discard!(pegged.peg.literal!(":")), Digit, Digit)), pegged.peg.fuse!(pegged.peg.option!(pegged.peg.and!(pegged.peg.literal!("."), Digit, Digit, Digit)))), "SDL.Duration"), "Duration")(TParseTree("", false,[], s)); 601 } 602 } 603 static string Duration(GetName g) 604 { 605 return "SDL.Duration"; 606 } 607 608 static TParseTree Number(TParseTree p) 609 { 610 if(__ctfe) 611 { 612 return pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.oneOrMore!(Digit), pegged.peg.option!(pegged.peg.keywords!("L", "BD")))), "SDL.Number")(p); 613 } 614 else 615 { 616 if (auto m = tuple(`Number`, p.end) in memo) 617 return *m; 618 else 619 { 620 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.oneOrMore!(Digit), pegged.peg.option!(pegged.peg.keywords!("L", "BD")))), "SDL.Number"), "Number")(p); 621 memo[tuple(`Number`, p.end)] = result; 622 return result; 623 } 624 } 625 } 626 627 static TParseTree Number(string s) 628 { 629 if(__ctfe) 630 { 631 return pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.oneOrMore!(Digit), pegged.peg.option!(pegged.peg.keywords!("L", "BD")))), "SDL.Number")(TParseTree("", false,[], s)); 632 } 633 else 634 { 635 forgetMemo(); 636 return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.oneOrMore!(Digit), pegged.peg.option!(pegged.peg.keywords!("L", "BD")))), "SDL.Number"), "Number")(TParseTree("", false,[], s)); 637 } 638 } 639 static string Number(GetName g) 640 { 641 return "SDL.Number"; 642 } 643 644 static TParseTree Float(TParseTree p) 645 { 646 if(__ctfe) 647 { 648 return pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.oneOrMore!(Digit), pegged.peg.literal!("."), pegged.peg.oneOrMore!(Digit), pegged.peg.option!(pegged.peg.literal!("f")))), "SDL.Float")(p); 649 } 650 else 651 { 652 if (auto m = tuple(`Float`, p.end) in memo) 653 return *m; 654 else 655 { 656 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.oneOrMore!(Digit), pegged.peg.literal!("."), pegged.peg.oneOrMore!(Digit), pegged.peg.option!(pegged.peg.literal!("f")))), "SDL.Float"), "Float")(p); 657 memo[tuple(`Float`, p.end)] = result; 658 return result; 659 } 660 } 661 } 662 663 static TParseTree Float(string s) 664 { 665 if(__ctfe) 666 { 667 return pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.oneOrMore!(Digit), pegged.peg.literal!("."), pegged.peg.oneOrMore!(Digit), pegged.peg.option!(pegged.peg.literal!("f")))), "SDL.Float")(TParseTree("", false,[], s)); 668 } 669 else 670 { 671 forgetMemo(); 672 return hooked!(pegged.peg.defined!(pegged.peg.fuse!(pegged.peg.and!(pegged.peg.oneOrMore!(Digit), pegged.peg.literal!("."), pegged.peg.oneOrMore!(Digit), pegged.peg.option!(pegged.peg.literal!("f")))), "SDL.Float"), "Float")(TParseTree("", false,[], s)); 673 } 674 } 675 static string Float(GetName g) 676 { 677 return "SDL.Float"; 678 } 679 680 static TParseTree Boolean(TParseTree p) 681 { 682 if(__ctfe) 683 { 684 return pegged.peg.defined!(pegged.peg.keywords!("true", "false", "on", "off"), "SDL.Boolean")(p); 685 } 686 else 687 { 688 if (auto m = tuple(`Boolean`, p.end) in memo) 689 return *m; 690 else 691 { 692 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.keywords!("true", "false", "on", "off"), "SDL.Boolean"), "Boolean")(p); 693 memo[tuple(`Boolean`, p.end)] = result; 694 return result; 695 } 696 } 697 } 698 699 static TParseTree Boolean(string s) 700 { 701 if(__ctfe) 702 { 703 return pegged.peg.defined!(pegged.peg.keywords!("true", "false", "on", "off"), "SDL.Boolean")(TParseTree("", false,[], s)); 704 } 705 else 706 { 707 forgetMemo(); 708 return hooked!(pegged.peg.defined!(pegged.peg.keywords!("true", "false", "on", "off"), "SDL.Boolean"), "Boolean")(TParseTree("", false,[], s)); 709 } 710 } 711 static string Boolean(GetName g) 712 { 713 return "SDL.Boolean"; 714 } 715 716 static TParseTree Null(TParseTree p) 717 { 718 if(__ctfe) 719 { 720 return pegged.peg.defined!(pegged.peg.literal!("null"), "SDL.Null")(p); 721 } 722 else 723 { 724 if (auto m = tuple(`Null`, p.end) in memo) 725 return *m; 726 else 727 { 728 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.literal!("null"), "SDL.Null"), "Null")(p); 729 memo[tuple(`Null`, p.end)] = result; 730 return result; 731 } 732 } 733 } 734 735 static TParseTree Null(string s) 736 { 737 if(__ctfe) 738 { 739 return pegged.peg.defined!(pegged.peg.literal!("null"), "SDL.Null")(TParseTree("", false,[], s)); 740 } 741 else 742 { 743 forgetMemo(); 744 return hooked!(pegged.peg.defined!(pegged.peg.literal!("null"), "SDL.Null"), "Null")(TParseTree("", false,[], s)); 745 } 746 } 747 static string Null(GetName g) 748 { 749 return "SDL.Null"; 750 } 751 752 static TParseTree Base64(TParseTree p) 753 { 754 if(__ctfe) 755 { 756 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!("[")), pegged.peg.fuse!(pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.literal!("+"), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("/")), pegged.peg.discard!(Spacing)))), pegged.peg.discard!(pegged.peg.literal!("]"))), "SDL.Base64")(p); 757 } 758 else 759 { 760 if (auto m = tuple(`Base64`, p.end) in memo) 761 return *m; 762 else 763 { 764 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!("[")), pegged.peg.fuse!(pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.literal!("+"), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("/")), pegged.peg.discard!(Spacing)))), pegged.peg.discard!(pegged.peg.literal!("]"))), "SDL.Base64"), "Base64")(p); 765 memo[tuple(`Base64`, p.end)] = result; 766 return result; 767 } 768 } 769 } 770 771 static TParseTree Base64(string s) 772 { 773 if(__ctfe) 774 { 775 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!("[")), pegged.peg.fuse!(pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.literal!("+"), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("/")), pegged.peg.discard!(Spacing)))), pegged.peg.discard!(pegged.peg.literal!("]"))), "SDL.Base64")(TParseTree("", false,[], s)); 776 } 777 else 778 { 779 forgetMemo(); 780 return hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.literal!("[")), pegged.peg.fuse!(pegged.peg.zeroOrMore!(pegged.peg.or!(pegged.peg.or!(pegged.peg.charRange!('a', 'z'), pegged.peg.charRange!('A', 'Z'), pegged.peg.literal!("+"), pegged.peg.charRange!('0', '9'), pegged.peg.literal!("/")), pegged.peg.discard!(Spacing)))), pegged.peg.discard!(pegged.peg.literal!("]"))), "SDL.Base64"), "Base64")(TParseTree("", false,[], s)); 781 } 782 } 783 static string Base64(GetName g) 784 { 785 return "SDL.Base64"; 786 } 787 788 static TParseTree UTC(TParseTree p) 789 { 790 if(__ctfe) 791 { 792 return pegged.peg.defined!(pegged.peg.literal!("-UTC"), "SDL.UTC")(p); 793 } 794 else 795 { 796 if (auto m = tuple(`UTC`, p.end) in memo) 797 return *m; 798 else 799 { 800 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.literal!("-UTC"), "SDL.UTC"), "UTC")(p); 801 memo[tuple(`UTC`, p.end)] = result; 802 return result; 803 } 804 } 805 } 806 807 static TParseTree UTC(string s) 808 { 809 if(__ctfe) 810 { 811 return pegged.peg.defined!(pegged.peg.literal!("-UTC"), "SDL.UTC")(TParseTree("", false,[], s)); 812 } 813 else 814 { 815 forgetMemo(); 816 return hooked!(pegged.peg.defined!(pegged.peg.literal!("-UTC"), "SDL.UTC"), "UTC")(TParseTree("", false,[], s)); 817 } 818 } 819 static string UTC(GetName g) 820 { 821 return "SDL.UTC"; 822 } 823 824 static TParseTree Digit(TParseTree p) 825 { 826 if(__ctfe) 827 { 828 return pegged.peg.defined!(pegged.peg.charRange!('0', '9'), "SDL.Digit")(p); 829 } 830 else 831 { 832 if (auto m = tuple(`Digit`, p.end) in memo) 833 return *m; 834 else 835 { 836 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.charRange!('0', '9'), "SDL.Digit"), "Digit")(p); 837 memo[tuple(`Digit`, p.end)] = result; 838 return result; 839 } 840 } 841 } 842 843 static TParseTree Digit(string s) 844 { 845 if(__ctfe) 846 { 847 return pegged.peg.defined!(pegged.peg.charRange!('0', '9'), "SDL.Digit")(TParseTree("", false,[], s)); 848 } 849 else 850 { 851 forgetMemo(); 852 return hooked!(pegged.peg.defined!(pegged.peg.charRange!('0', '9'), "SDL.Digit"), "Digit")(TParseTree("", false,[], s)); 853 } 854 } 855 static string Digit(GetName g) 856 { 857 return "SDL.Digit"; 858 } 859 860 static TParseTree Char(TParseTree p) 861 { 862 if(__ctfe) 863 { 864 return pegged.peg.defined!(pegged.peg.or!(pegged.peg.and!(pegged.peg.negLookahead!(doublequote), pegged.peg.negLookahead!(endOfLine), pegged.peg.any), pegged.peg.and!(backslash, doublequote)), "SDL.Char")(p); 865 } 866 else 867 { 868 if (auto m = tuple(`Char`, p.end) in memo) 869 return *m; 870 else 871 { 872 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.or!(pegged.peg.and!(pegged.peg.negLookahead!(doublequote), pegged.peg.negLookahead!(endOfLine), pegged.peg.any), pegged.peg.and!(backslash, doublequote)), "SDL.Char"), "Char")(p); 873 memo[tuple(`Char`, p.end)] = result; 874 return result; 875 } 876 } 877 } 878 879 static TParseTree Char(string s) 880 { 881 if(__ctfe) 882 { 883 return pegged.peg.defined!(pegged.peg.or!(pegged.peg.and!(pegged.peg.negLookahead!(doublequote), pegged.peg.negLookahead!(endOfLine), pegged.peg.any), pegged.peg.and!(backslash, doublequote)), "SDL.Char")(TParseTree("", false,[], s)); 884 } 885 else 886 { 887 forgetMemo(); 888 return hooked!(pegged.peg.defined!(pegged.peg.or!(pegged.peg.and!(pegged.peg.negLookahead!(doublequote), pegged.peg.negLookahead!(endOfLine), pegged.peg.any), pegged.peg.and!(backslash, doublequote)), "SDL.Char"), "Char")(TParseTree("", false,[], s)); 889 } 890 } 891 static string Char(GetName g) 892 { 893 return "SDL.Char"; 894 } 895 896 static TParseTree Spacing(TParseTree p) 897 { 898 if(__ctfe) 899 { 900 return pegged.peg.defined!(pegged.peg.or!(BlockComment, pegged.peg.and!(backslash, endOfLine), pegged.peg.discard!(pegged.peg.zeroOrMore!(pegged.peg.keywords!(" ", "\t")))), "SDL.Spacing")(p); 901 } 902 else 903 { 904 if (auto m = tuple(`Spacing`, p.end) in memo) 905 return *m; 906 else 907 { 908 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.or!(BlockComment, pegged.peg.and!(backslash, endOfLine), pegged.peg.discard!(pegged.peg.zeroOrMore!(pegged.peg.keywords!(" ", "\t")))), "SDL.Spacing"), "Spacing")(p); 909 memo[tuple(`Spacing`, p.end)] = result; 910 return result; 911 } 912 } 913 } 914 915 static TParseTree Spacing(string s) 916 { 917 if(__ctfe) 918 { 919 return pegged.peg.defined!(pegged.peg.or!(BlockComment, pegged.peg.and!(backslash, endOfLine), pegged.peg.discard!(pegged.peg.zeroOrMore!(pegged.peg.keywords!(" ", "\t")))), "SDL.Spacing")(TParseTree("", false,[], s)); 920 } 921 else 922 { 923 forgetMemo(); 924 return hooked!(pegged.peg.defined!(pegged.peg.or!(BlockComment, pegged.peg.and!(backslash, endOfLine), pegged.peg.discard!(pegged.peg.zeroOrMore!(pegged.peg.keywords!(" ", "\t")))), "SDL.Spacing"), "Spacing")(TParseTree("", false,[], s)); 925 } 926 } 927 static string Spacing(GetName g) 928 { 929 return "SDL.Spacing"; 930 } 931 932 static TParseTree EOL(TParseTree p) 933 { 934 if(__ctfe) 935 { 936 return pegged.peg.defined!(pegged.peg.discard!(pegged.peg.or!(endOfLine, LineComment)), "SDL.EOL")(p); 937 } 938 else 939 { 940 if (auto m = tuple(`EOL`, p.end) in memo) 941 return *m; 942 else 943 { 944 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.discard!(pegged.peg.or!(endOfLine, LineComment)), "SDL.EOL"), "EOL")(p); 945 memo[tuple(`EOL`, p.end)] = result; 946 return result; 947 } 948 } 949 } 950 951 static TParseTree EOL(string s) 952 { 953 if(__ctfe) 954 { 955 return pegged.peg.defined!(pegged.peg.discard!(pegged.peg.or!(endOfLine, LineComment)), "SDL.EOL")(TParseTree("", false,[], s)); 956 } 957 else 958 { 959 forgetMemo(); 960 return hooked!(pegged.peg.defined!(pegged.peg.discard!(pegged.peg.or!(endOfLine, LineComment)), "SDL.EOL"), "EOL")(TParseTree("", false,[], s)); 961 } 962 } 963 static string EOL(GetName g) 964 { 965 return "SDL.EOL"; 966 } 967 968 static TParseTree LineComment(TParseTree p) 969 { 970 if(__ctfe) 971 { 972 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.keywords!("//", "--", "#")), pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(endOfLine), pegged.peg.any)), endOfLine), "SDL.LineComment")(p); 973 } 974 else 975 { 976 if (auto m = tuple(`LineComment`, p.end) in memo) 977 return *m; 978 else 979 { 980 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.keywords!("//", "--", "#")), pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(endOfLine), pegged.peg.any)), endOfLine), "SDL.LineComment"), "LineComment")(p); 981 memo[tuple(`LineComment`, p.end)] = result; 982 return result; 983 } 984 } 985 } 986 987 static TParseTree LineComment(string s) 988 { 989 if(__ctfe) 990 { 991 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.keywords!("//", "--", "#")), pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(endOfLine), pegged.peg.any)), endOfLine), "SDL.LineComment")(TParseTree("", false,[], s)); 992 } 993 else 994 { 995 forgetMemo(); 996 return hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.discard!(pegged.peg.keywords!("//", "--", "#")), pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(endOfLine), pegged.peg.any)), endOfLine), "SDL.LineComment"), "LineComment")(TParseTree("", false,[], s)); 997 } 998 } 999 static string LineComment(GetName g) 1000 { 1001 return "SDL.LineComment"; 1002 } 1003 1004 static TParseTree BlockComment(TParseTree p) 1005 { 1006 if(__ctfe) 1007 { 1008 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.literal!("/*"), pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(pegged.peg.literal!("*/")), pegged.peg.any)), pegged.peg.literal!("*/")), "SDL.BlockComment")(p); 1009 } 1010 else 1011 { 1012 if (auto m = tuple(`BlockComment`, p.end) in memo) 1013 return *m; 1014 else 1015 { 1016 TParseTree result = hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.literal!("/*"), pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(pegged.peg.literal!("*/")), pegged.peg.any)), pegged.peg.literal!("*/")), "SDL.BlockComment"), "BlockComment")(p); 1017 memo[tuple(`BlockComment`, p.end)] = result; 1018 return result; 1019 } 1020 } 1021 } 1022 1023 static TParseTree BlockComment(string s) 1024 { 1025 if(__ctfe) 1026 { 1027 return pegged.peg.defined!(pegged.peg.and!(pegged.peg.literal!("/*"), pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(pegged.peg.literal!("*/")), pegged.peg.any)), pegged.peg.literal!("*/")), "SDL.BlockComment")(TParseTree("", false,[], s)); 1028 } 1029 else 1030 { 1031 forgetMemo(); 1032 return hooked!(pegged.peg.defined!(pegged.peg.and!(pegged.peg.literal!("/*"), pegged.peg.zeroOrMore!(pegged.peg.and!(pegged.peg.negLookahead!(pegged.peg.literal!("*/")), pegged.peg.any)), pegged.peg.literal!("*/")), "SDL.BlockComment"), "BlockComment")(TParseTree("", false,[], s)); 1033 } 1034 } 1035 static string BlockComment(GetName g) 1036 { 1037 return "SDL.BlockComment"; 1038 } 1039 1040 static TParseTree opCall(TParseTree p) 1041 { 1042 TParseTree result = decimateTree(TagTree(p)); 1043 result.children = [result]; 1044 result.name = "SDL"; 1045 return result; 1046 } 1047 1048 static TParseTree opCall(string input) 1049 { 1050 if(__ctfe) 1051 { 1052 return SDL(TParseTree(``, false, [], input, 0, 0)); 1053 } 1054 else 1055 { 1056 forgetMemo(); 1057 return SDL(TParseTree(``, false, [], input, 0, 0)); 1058 } 1059 } 1060 static string opCall(GetName g) 1061 { 1062 return "SDL"; 1063 } 1064 1065 1066 static void forgetMemo() 1067 { 1068 memo = null; 1069 } 1070 } 1071 } 1072 1073 alias GenericSDL!(ParseTree).SDL SDL; 1074