1 /** 2 This module was automatically generated from the following grammar: 3 4 Cursive: 5 Program <- Spacing Module Spacing (Declaration Spacing)* Spacing eoi 6 LineComment <- :(slash slash (&(endOfLine / eoi) (endOfLine / eoi) / .*)) 7 BlockComment <- :(slash '*' (&('*' slash) '*' slash / .*)) 8 9 Boolean <- 'true' / 'false' 10 Null <- 'null' 11 12 IntegerSuffix <- slash ('i8' / 'u8' / 'i16' / 'u16' / 'i32' / 'u32' / 'i64' / 'u64') 13 RealSuffix <- slash ('f32' / 'f64') 14 15 Sign <- '+' / '-' 16 17 Decimal <~ [0-9]+ 18 Binary <~ '0' ('b' / 'B') [0-1]+ 19 Octal <~ '0' ('o' / 'O') [0-7]+ 20 Hexadecimal <~ '0' ('x' / 'X') [0-9a-fA-F]+ 21 22 Size <- Binary / Octal / Hexadecimal / Decimal 23 Integer <- Sign? (Binary / Octal / Hexadecimal / Decimal) IntegerSuffix 24 Real <- Sign? Decimal '.' Decimal (('e' / 'E') Sign? Decimal)? RealSuffix 25 26 EscapeSequence <- backslash (quote / doublequote / backslash / 'a' / 'b' / 'f' / 'n' / 'r' / 't' / 'v' / '0') 27 UnicodeSequence <- backslash ('u' / 'U') '+'? [0-9a-fA-F]+ 28 29 Character <~ :quote (EscapeSequence / UnicodeSequence / !quote .) :quote 30 String <~ :doublequote (EscapeSequence / UnicodeSequence / !doublequote .)* :doublequote 31 32 Literal <- Boolean / Null / Real / Integer / Character / String 33 34 Qualifiedidentifier <- identifier (Spacing '.' Spacing identifier)* 35 36 FixedIntegralType <- 'int8' / 'uint8' / 'int16' / 'uint16' / 'int32' / 'uint32' / 'int64' / 'uint64' 37 IntegralType <- FixedIntegralType / 'int' / 'uint' 38 FloatingPointType <- 'float32' / 'float64' 39 CoreType <- 'object' / 'bool' / IntegralType / FloatingPointType 40 41 TypeReference <- Qualifiedidentifier (Spacing GenericParameters)? 42 TypeSpecification <- (CoreType / TypeReference) Spacing NullableType? 43 GenericParameters <- '<' Spacing Type (Spacing ',' Spacing Type)* Spacing '>' 44 45 FunctionType <- CallingConvention? Spacing ParameterTypes Spacing NullableType? 46 ParameterTypes <- '(' Spacing (Type (Spacing ',' Spacing Type)*)? ')' 47 48 PointerType <- '*' 49 ArrayType <- '[' Spacing ']' 50 VectorType <- '[' Spacing Size Spacing ']' 51 NullableType <- '?' 52 53 TupleType <- '{' Spacing Type (Spacing ',' Spacing Type)* Spacing '}' 54 55 TypeModifiers <- (PointerType / ArrayType / VectorType)+ Spacing NullableType? 56 Type <- TupleType / TypeSpecification (Spacing (TypeModifiers / FunctionType))? 57 InferredType <- 'var' / Type 58 59 ReturnType <- 'void' / Type 60 CallingConvention <- 'cdecl' / 'stdcall' 61 62 Module <- 'module' Spacing Qualifiedidentifier Spacing ';' 63 64 Import <- 'import' Spacing Qualifiedidentifier (Spacing ',' Spacing Qualifiedidentifier)* ';' 65 66 Declaration <- Import / Class / Interface / Struct / Enum / Data / ModuleConstructor / ModuleFinalizer / Field / ModuleFunction / Operator 67 68 Visibility <- 'public' / 'internal' / 'private' / 'protected' (('and' / 'or') 'internal')? 69 70 InheritanceList <- ':' Spacing TypeReference (Spacing ',' Spacing TypeReference)* 71 72 Class <- Visibility? Spacing ClassModifiers Spacing 'class' Spacing identifier Spacing InheritanceList? '{' Spacing (ClassMember Spacing)* Spacing '}' 73 ClassModifiers <- ('open' / 'abstract')? Spacing ('pure' / 'impure')? Spacing ('safe' / 'unsafe')? 74 ClassMember <- ClassConstructor / ClassFinalizer / Constructor / Finalizer / Field / Property / Method / Operator 75 76 Interface <- Visibility? Spacing 'interface' Spacing identifier Spacing InheritanceList? Spacing '{' Spacing (InterfaceMember Spacing)* Spacing '}' 77 InterfaceMember <- Property / Method / Operator 78 79 Struct <- Visibility? Spacing StructModifiers Spacing 'struct' Spacing identifier Spacing InheritanceList? Spacing '{' Spacing (StructMember Spacing)* Spacing '}' 80 StructModifiers <- ('pure' / 'impure')? Spacing ('safe' / 'unsafe')? 81 StructMember <- StructConstructor / StructFinalizer / Constructor / Field / Property / Function / Operator 82 83 Enum <- Visibility? Spacing 'enum' Spacing identifier Spacing EnumBase Spacing '{' Spacing (EnumMember Spacing)* Spacing '}' 84 EnumBase <- 'of' Spacing FixedIntegralType 85 EnumMember <- identifier (Spacing ',' Spacing identifier)* Spacing '=' Spacing Size Spacing ';' 86 87 Data <- Visibility? Spacing 'data' Spacing DataSemantics Spacing identifier Spacing '{' Spacing (DataMember Spacing)* Spacing '}' 88 DataSemantics <- 'byref' / 'byval' 89 DataMember <- DataField / DataCase / Property / Function / Operator 90 DataField <- Type Spacing identifier (Spacing ',' Spacing identifier)* Spacing ';' 91 DataCase <- 'case' Spacing identifier '{' Spacing (DataField Spacing)* Spacing '}' 92 93 StaticConstructorModifiers <- 'thread'? Spacing ('pure' / 'impure')? Spacing ('safe' / 'unsafe')? 94 StaticConstructorBody <- BlockStatement 95 96 ModuleConstructor <- StaticConstructorModifiers Spacing 'module' Spacing '(' Spacing ')' Spacing StaticConstructorBody 97 ModuleFinalizer <- StaticConstructorModifiers Spacing '~' Spacing 'module' Spacing EmptyParameterList Spacing StaticConstructorBody 98 99 ClassConstructor <- StaticConstructorModifiers Spacing 'class' Spacing '(' Spacing ')' Spacing StaticConstructorBody 100 ClassFinalizer <- StaticConstructorModifiers Spacing '~' Spacing 'class' Spacing EmptyParameterList Spacing StaticConstructorBody 101 102 StructConstructor <- StaticConstructorModifiers Spacing 'struct' Spacing '(' Spacing ')' Spacing StaticConstructorBody 103 StructFinalizer <- StaticConstructorModifiers Spacing '~' Spacing 'struct' Spacing EmptyParameterList Spacing StaticConstructorBody 104 105 Field <- Visibility? Spacing FieldModifiers Spacing Type Spacing identifier (Spacing ',' Spacing identifier)* Spacing ';' 106 FieldModifiers <- 'const' / ('thread' / 'static')? Spacing 'final'? 107 108 ModuleFunction <- RawFunction / ExternFunction / Function 109 110 RawFunction <- Visibility? Spacing 'raw' Spacing ReturnType Spacing identifier Spacing ParameterList Spacing RawFunctionBody 111 RawFunctionBody <- BlockStatement 112 113 ExternFunction <- Visibility? Spacing 'extern' Spacing ExternFunctionLocation Spacing ReturnType Spacing identifier Spacing ParameterList Spacing ';' 114 ExternFunctionLocation <- '(' Spacing String Spacing ',' Spacing String Spacing ')' 115 116 Function <- Visibility? Spacing FunctionModifiers Spacing ReturnType Spacing identifier Spacing ParameterList Spacing FunctionBody 117 FunctionModifiers <- ('pure' / 'impure')? Spacing ('safe' / 'unsafe')? 118 FunctionBody <- BlockStatement 119 120 EmptyParameterList <- '(' Spacing ')' 121 ParameterList <- '(' Spacing (Parameter (Spacing ',' Spacing Parameter)*)? Spacing ')' 122 Parameter <- ParameterModifiers Spacing Type Spacing identifier 123 ParameterModifiers <- ('ref' / 'out' / 'params')? 124 125 Operator <- Visibility? Spacing Type Spacing 'operator' Spacing CustomOperator Spacing ParameterList Spacing OperatorBody 126 CustomOperator <- '+' / '-' / '*' / slash / '%' / '&' / '|' / '^' 127 OperatorBody <- BlockStatement 128 129 Property <- Visibility? Spacing PropertyModifiers Spacing Type Spacing identifier Spacing '{' Spacing PropertyBody Spacing '}' 130 PropertyModifiers <- ('pure' / 'impure')? Spacing ('safe' / 'unsafe')? Spacing (('virtual' / 'abstract') / 'override'? Spacing 'final'?) 131 PropertyBody <- PropertyGetter Spacing PropertySetter / PropertyGetter / PropertySetter 132 PropertyGetter <- AccessorModifiers Spacing 'get' Spacing AccessorBody 133 PropertySetter <- AccessorModifiers Spacing 'set' Spacing AccessorBody 134 AccessorModifiers <- ('pure' / 'impure')? Spacing ('safe' / 'unsafe')? 135 AccessorBody <- BlockStatement / ';' 136 137 Method <- Visibility? Spacing MethodModifiers Spacing ReturnType Spacing identifier Spacing ParameterList Spacing MethodBody 138 MethodModifiers <- ('pure' / 'impure')? Spacing ('safe' / 'unsafe')? Spacing (('virtual' / 'abstract') / 'override'? Spacing 'final'?) 139 MethodBody <- BlockStatement / ';' 140 141 Constructor <- Visibility? Spacing 'this' Spacing ParameterList Spacing FunctionBody 142 Finalizer <- '~' Spacing 'this' Spacing EmptyParameterList Spacing FunctionBody 143 144 BlockStatement <- '{' Spacing '}' 145 146 147 148 */ 149 module pegged.performancetest.cursive.parser; 150 151 public import pegged.peg; 152 struct Cursive 153 { 154 import std.typecons:Tuple, tuple; 155 static ParseTree[Tuple!(string, uint)] memo; 156 static bool[string] names; 157 static this() 158 { 159 names = [`Program`:true, `LineComment`:true, `BlockComment`:true, `Boolean`:true, 160 `Null`:true, `IntegerSuffix`:true, `RealSuffix`:true, `Sign`:true, 161 `Decimal`:true, `Binary`:true, `Octal`:true, `Hexadecimal`:true, 162 `Size`:true, `Integer`:true, `Real`:true, `EscapeSequence`:true, 163 `UnicodeSequence`:true, `Character`:true, `String`:true, `Literal`:true, 164 `Qualifiedidentifier`:true, `FixedIntegralType`:true, `IntegralType`:true, `FloatingPointType`:true, 165 `CoreType`:true, `TypeReference`:true, `TypeSpecification`:true, `GenericParameters`:true, 166 `FunctionType`:true, `ParameterTypes`:true, `PointerType`:true, `ArrayType`:true, 167 `VectorType`:true, `NullableType`:true, `TupleType`:true, `TypeModifiers`:true, 168 `Type`:true, `InferredType`:true, `ReturnType`:true, `CallingConvention`:true, 169 `Module`:true, `Import`:true, `Declaration`:true, `Visibility`:true, 170 `InheritanceList`:true, `Class`:true, `ClassModifiers`:true, `ClassMember`:true, 171 `Interface`:true, `InterfaceMember`:true, `Struct`:true, `StructModifiers`:true, 172 `StructMember`:true, `Enum`:true, `EnumBase`:true, `EnumMember`:true, 173 `Data`:true, `DataSemantics`:true, `DataMember`:true, `DataField`:true, 174 `DataCase`:true, `StaticConstructorModifiers`:true, `StaticConstructorBody`:true, `ModuleConstructor`:true, 175 `ModuleFinalizer`:true, `ClassConstructor`:true, `ClassFinalizer`:true, `StructConstructor`:true, 176 `StructFinalizer`:true, `Field`:true, `FieldModifiers`:true, `ModuleFunction`:true, 177 `RawFunction`:true, `RawFunctionBody`:true, `ExternFunction`:true, `ExternFunctionLocation`:true, 178 `Function`:true, `FunctionModifiers`:true, `FunctionBody`:true, `EmptyParameterList`:true, 179 `ParameterList`:true, `Parameter`:true, `ParameterModifiers`:true, `Operator`:true, 180 `CustomOperator`:true, `OperatorBody`:true, `Property`:true, `PropertyModifiers`:true, 181 `PropertyBody`:true, `PropertyGetter`:true, `PropertySetter`:true, `AccessorModifiers`:true, 182 `AccessorBody`:true, `Method`:true, `MethodModifiers`:true, `MethodBody`:true, 183 `Constructor`:true, `Finalizer`:true, `BlockStatement`:true]; 184 } 185 static ParseTree decimateTree(ParseTree p) 186 { 187 if(p.children.length == 0) return p; 188 189 ParseTree[] filterChildren(ParseTree pt) 190 { 191 ParseTree[] result; 192 foreach(child; pt.children) 193 { 194 if (child.name in names) // keep nodes that belongs to the current grammar 195 { 196 child.children = filterChildren(child); 197 result ~= child; 198 } 199 else if (child.name == "keep") // 'keep' node are never discarded. They have only one child, the node to keep 200 { 201 result ~= child.children[0]; 202 } 203 else // discard this node, but see if its children contain nodes to keep 204 { 205 result ~= filterChildren(child); 206 } 207 } 208 return result; 209 } 210 p.children = filterChildren(p); 211 return p; 212 } 213 214 alias spacing Spacing; 215 216 static ParseTree Program(ParseTree p) 217 { 218 if(auto m = tuple("Program",p.end) in memo) 219 return *m; 220 else 221 { 222 ParseTree result = named!(and!(Spacing, Module, Spacing, zeroOrMore!(and!(Declaration, Spacing)), Spacing, eoi), "Program")(p); 223 memo[tuple("Program",p.end)] = result; 224 return result; 225 } 226 } 227 228 static ParseTree Program(string s) 229 { 230 memo = null; 231 return Program(ParseTree("", false,[], s)); 232 } 233 234 static ParseTree LineComment(ParseTree p) 235 { 236 if(auto m = tuple("LineComment",p.end) in memo) 237 return *m; 238 else 239 { 240 ParseTree result = named!(and!(discard!(and!(slash, slash, or!(and!(posLookahead!(or!(and!(endOfLine), and!(eoi))), or!(and!(endOfLine), and!(eoi))), and!(zeroOrMore!(pegged.peg.any)))))), "LineComment")(p); 241 memo[tuple("LineComment",p.end)] = result; 242 return result; 243 } 244 } 245 246 static ParseTree LineComment(string s) 247 { 248 memo = null; 249 return LineComment(ParseTree("", false,[], s)); 250 } 251 252 static ParseTree BlockComment(ParseTree p) 253 { 254 if(auto m = tuple("BlockComment",p.end) in memo) 255 return *m; 256 else 257 { 258 ParseTree result = named!(and!(discard!(and!(slash, literal!("*"), or!(and!(posLookahead!(and!(literal!("*"), slash)), literal!("*"), slash), and!(zeroOrMore!(pegged.peg.any)))))), "BlockComment")(p); 259 memo[tuple("BlockComment",p.end)] = result; 260 return result; 261 } 262 } 263 264 static ParseTree BlockComment(string s) 265 { 266 memo = null; 267 return BlockComment(ParseTree("", false,[], s)); 268 } 269 270 static ParseTree Boolean(ParseTree p) 271 { 272 if(auto m = tuple("Boolean",p.end) in memo) 273 return *m; 274 else 275 { 276 ParseTree result = named!(or!(and!(literal!("true")), and!(literal!("false"))), "Boolean")(p); 277 memo[tuple("Boolean",p.end)] = result; 278 return result; 279 } 280 } 281 282 static ParseTree Boolean(string s) 283 { 284 memo = null; 285 return Boolean(ParseTree("", false,[], s)); 286 } 287 288 static ParseTree Null(ParseTree p) 289 { 290 if(auto m = tuple("Null",p.end) in memo) 291 return *m; 292 else 293 { 294 ParseTree result = named!(and!(literal!("null")), "Null")(p); 295 memo[tuple("Null",p.end)] = result; 296 return result; 297 } 298 } 299 300 static ParseTree Null(string s) 301 { 302 memo = null; 303 return Null(ParseTree("", false,[], s)); 304 } 305 306 static ParseTree IntegerSuffix(ParseTree p) 307 { 308 if(auto m = tuple("IntegerSuffix",p.end) in memo) 309 return *m; 310 else 311 { 312 ParseTree result = named!(and!(slash, or!(and!(literal!("i8")), and!(literal!("u8")), and!(literal!("i16")), and!(literal!("u16")), and!(literal!("i32")), and!(literal!("u32")), and!(literal!("i64")), and!(literal!("u64")))), "IntegerSuffix")(p); 313 memo[tuple("IntegerSuffix",p.end)] = result; 314 return result; 315 } 316 } 317 318 static ParseTree IntegerSuffix(string s) 319 { 320 memo = null; 321 return IntegerSuffix(ParseTree("", false,[], s)); 322 } 323 324 static ParseTree RealSuffix(ParseTree p) 325 { 326 if(auto m = tuple("RealSuffix",p.end) in memo) 327 return *m; 328 else 329 { 330 ParseTree result = named!(and!(slash, or!(and!(literal!("f32")), and!(literal!("f64")))), "RealSuffix")(p); 331 memo[tuple("RealSuffix",p.end)] = result; 332 return result; 333 } 334 } 335 336 static ParseTree RealSuffix(string s) 337 { 338 memo = null; 339 return RealSuffix(ParseTree("", false,[], s)); 340 } 341 342 static ParseTree Sign(ParseTree p) 343 { 344 if(auto m = tuple("Sign",p.end) in memo) 345 return *m; 346 else 347 { 348 ParseTree result = named!(or!(and!(literal!("+")), and!(literal!("-"))), "Sign")(p); 349 memo[tuple("Sign",p.end)] = result; 350 return result; 351 } 352 } 353 354 static ParseTree Sign(string s) 355 { 356 memo = null; 357 return Sign(ParseTree("", false,[], s)); 358 } 359 360 static ParseTree Decimal(ParseTree p) 361 { 362 if(auto m = tuple("Decimal",p.end) in memo) 363 return *m; 364 else 365 { 366 ParseTree result = named!(fuse!(and!(oneOrMore!(charRange!('0', '9')))), "Decimal")(p); 367 memo[tuple("Decimal",p.end)] = result; 368 return result; 369 } 370 } 371 372 static ParseTree Decimal(string s) 373 { 374 memo = null; 375 return Decimal(ParseTree("", false,[], s)); 376 } 377 378 static ParseTree Binary(ParseTree p) 379 { 380 if(auto m = tuple("Binary",p.end) in memo) 381 return *m; 382 else 383 { 384 ParseTree result = named!(fuse!(and!(literal!("0"), or!(and!(literal!("b")), and!(literal!("B"))), oneOrMore!(charRange!('0', '1')))), "Binary")(p); 385 memo[tuple("Binary",p.end)] = result; 386 return result; 387 } 388 } 389 390 static ParseTree Binary(string s) 391 { 392 memo = null; 393 return Binary(ParseTree("", false,[], s)); 394 } 395 396 static ParseTree Octal(ParseTree p) 397 { 398 if(auto m = tuple("Octal",p.end) in memo) 399 return *m; 400 else 401 { 402 ParseTree result = named!(fuse!(and!(literal!("0"), or!(and!(literal!("o")), and!(literal!("O"))), oneOrMore!(charRange!('0', '7')))), "Octal")(p); 403 memo[tuple("Octal",p.end)] = result; 404 return result; 405 } 406 } 407 408 static ParseTree Octal(string s) 409 { 410 memo = null; 411 return Octal(ParseTree("", false,[], s)); 412 } 413 414 static ParseTree Hexadecimal(ParseTree p) 415 { 416 if(auto m = tuple("Hexadecimal",p.end) in memo) 417 return *m; 418 else 419 { 420 ParseTree result = named!(fuse!(and!(literal!("0"), or!(and!(literal!("x")), and!(literal!("X"))), oneOrMore!(or!(charRange!('0', '9'), charRange!('a', 'f'), charRange!('A', 'F'))))), "Hexadecimal")(p); 421 memo[tuple("Hexadecimal",p.end)] = result; 422 return result; 423 } 424 } 425 426 static ParseTree Hexadecimal(string s) 427 { 428 memo = null; 429 return Hexadecimal(ParseTree("", false,[], s)); 430 } 431 432 static ParseTree Size(ParseTree p) 433 { 434 if(auto m = tuple("Size",p.end) in memo) 435 return *m; 436 else 437 { 438 ParseTree result = named!(or!(and!(Binary), and!(Octal), and!(Hexadecimal), and!(Decimal)), "Size")(p); 439 memo[tuple("Size",p.end)] = result; 440 return result; 441 } 442 } 443 444 static ParseTree Size(string s) 445 { 446 memo = null; 447 return Size(ParseTree("", false,[], s)); 448 } 449 450 static ParseTree Integer(ParseTree p) 451 { 452 if(auto m = tuple("Integer",p.end) in memo) 453 return *m; 454 else 455 { 456 ParseTree result = named!(and!(option!(Sign), or!(and!(Binary), and!(Octal), and!(Hexadecimal), and!(Decimal)), IntegerSuffix), "Integer")(p); 457 memo[tuple("Integer",p.end)] = result; 458 return result; 459 } 460 } 461 462 static ParseTree Integer(string s) 463 { 464 memo = null; 465 return Integer(ParseTree("", false,[], s)); 466 } 467 468 static ParseTree Real(ParseTree p) 469 { 470 if(auto m = tuple("Real",p.end) in memo) 471 return *m; 472 else 473 { 474 ParseTree result = named!(and!(option!(Sign), Decimal, literal!("."), Decimal, option!(and!(or!(and!(literal!("e")), and!(literal!("E"))), option!(Sign), Decimal)), RealSuffix), "Real")(p); 475 memo[tuple("Real",p.end)] = result; 476 return result; 477 } 478 } 479 480 static ParseTree Real(string s) 481 { 482 memo = null; 483 return Real(ParseTree("", false,[], s)); 484 } 485 486 static ParseTree EscapeSequence(ParseTree p) 487 { 488 if(auto m = tuple("EscapeSequence",p.end) in memo) 489 return *m; 490 else 491 { 492 ParseTree result = named!(and!(backslash, or!(and!(quote), and!(doublequote), and!(backslash), and!(literal!("a")), and!(literal!("b")), and!(literal!("f")), and!(literal!("n")), and!(literal!("r")), and!(literal!("t")), and!(literal!("v")), and!(literal!("0")))), "EscapeSequence")(p); 493 memo[tuple("EscapeSequence",p.end)] = result; 494 return result; 495 } 496 } 497 498 static ParseTree EscapeSequence(string s) 499 { 500 memo = null; 501 return EscapeSequence(ParseTree("", false,[], s)); 502 } 503 504 static ParseTree UnicodeSequence(ParseTree p) 505 { 506 if(auto m = tuple("UnicodeSequence",p.end) in memo) 507 return *m; 508 else 509 { 510 ParseTree result = named!(and!(backslash, or!(and!(literal!("u")), and!(literal!("U"))), option!(literal!("+")), oneOrMore!(or!(charRange!('0', '9'), charRange!('a', 'f'), charRange!('A', 'F')))), "UnicodeSequence")(p); 511 memo[tuple("UnicodeSequence",p.end)] = result; 512 return result; 513 } 514 } 515 516 static ParseTree UnicodeSequence(string s) 517 { 518 memo = null; 519 return UnicodeSequence(ParseTree("", false,[], s)); 520 } 521 522 static ParseTree Character(ParseTree p) 523 { 524 if(auto m = tuple("Character",p.end) in memo) 525 return *m; 526 else 527 { 528 ParseTree result = named!(fuse!(and!(discard!(quote), or!(and!(EscapeSequence), and!(UnicodeSequence), and!(negLookahead!(quote), pegged.peg.any)), discard!(quote))), "Character")(p); 529 memo[tuple("Character",p.end)] = result; 530 return result; 531 } 532 } 533 534 static ParseTree Character(string s) 535 { 536 memo = null; 537 return Character(ParseTree("", false,[], s)); 538 } 539 540 static ParseTree String(ParseTree p) 541 { 542 if(auto m = tuple("String",p.end) in memo) 543 return *m; 544 else 545 { 546 ParseTree result = named!(fuse!(and!(discard!(doublequote), zeroOrMore!(or!(and!(EscapeSequence), and!(UnicodeSequence), and!(negLookahead!(doublequote), pegged.peg.any))), discard!(doublequote))), "String")(p); 547 memo[tuple("String",p.end)] = result; 548 return result; 549 } 550 } 551 552 static ParseTree String(string s) 553 { 554 memo = null; 555 return String(ParseTree("", false,[], s)); 556 } 557 558 static ParseTree Literal(ParseTree p) 559 { 560 if(auto m = tuple("Literal",p.end) in memo) 561 return *m; 562 else 563 { 564 ParseTree result = named!(or!(and!(Boolean), and!(Null), and!(Real), and!(Integer), and!(Character), and!(String)), "Literal")(p); 565 memo[tuple("Literal",p.end)] = result; 566 return result; 567 } 568 } 569 570 static ParseTree Literal(string s) 571 { 572 memo = null; 573 return Literal(ParseTree("", false,[], s)); 574 } 575 576 static ParseTree Qualifiedidentifier(ParseTree p) 577 { 578 if(auto m = tuple("Qualifiedidentifier",p.end) in memo) 579 return *m; 580 else 581 { 582 ParseTree result = named!(and!(identifier, zeroOrMore!(and!(Spacing, literal!("."), Spacing, identifier))), "Qualifiedidentifier")(p); 583 memo[tuple("Qualifiedidentifier",p.end)] = result; 584 return result; 585 } 586 } 587 588 static ParseTree Qualifiedidentifier(string s) 589 { 590 memo = null; 591 return Qualifiedidentifier(ParseTree("", false,[], s)); 592 } 593 594 static ParseTree FixedIntegralType(ParseTree p) 595 { 596 if(auto m = tuple("FixedIntegralType",p.end) in memo) 597 return *m; 598 else 599 { 600 ParseTree result = named!(or!(and!(literal!("int8")), and!(literal!("uint8")), and!(literal!("int16")), and!(literal!("uint16")), and!(literal!("int32")), and!(literal!("uint32")), and!(literal!("int64")), and!(literal!("uint64"))), "FixedIntegralType")(p); 601 memo[tuple("FixedIntegralType",p.end)] = result; 602 return result; 603 } 604 } 605 606 static ParseTree FixedIntegralType(string s) 607 { 608 memo = null; 609 return FixedIntegralType(ParseTree("", false,[], s)); 610 } 611 612 static ParseTree IntegralType(ParseTree p) 613 { 614 if(auto m = tuple("IntegralType",p.end) in memo) 615 return *m; 616 else 617 { 618 ParseTree result = named!(or!(and!(FixedIntegralType), and!(literal!("int")), and!(literal!("uint"))), "IntegralType")(p); 619 memo[tuple("IntegralType",p.end)] = result; 620 return result; 621 } 622 } 623 624 static ParseTree IntegralType(string s) 625 { 626 memo = null; 627 return IntegralType(ParseTree("", false,[], s)); 628 } 629 630 static ParseTree FloatingPointType(ParseTree p) 631 { 632 if(auto m = tuple("FloatingPointType",p.end) in memo) 633 return *m; 634 else 635 { 636 ParseTree result = named!(or!(and!(literal!("float32")), and!(literal!("float64"))), "FloatingPointType")(p); 637 memo[tuple("FloatingPointType",p.end)] = result; 638 return result; 639 } 640 } 641 642 static ParseTree FloatingPointType(string s) 643 { 644 memo = null; 645 return FloatingPointType(ParseTree("", false,[], s)); 646 } 647 648 static ParseTree CoreType(ParseTree p) 649 { 650 if(auto m = tuple("CoreType",p.end) in memo) 651 return *m; 652 else 653 { 654 ParseTree result = named!(or!(and!(literal!("object")), and!(literal!("bool")), and!(IntegralType), and!(FloatingPointType)), "CoreType")(p); 655 memo[tuple("CoreType",p.end)] = result; 656 return result; 657 } 658 } 659 660 static ParseTree CoreType(string s) 661 { 662 memo = null; 663 return CoreType(ParseTree("", false,[], s)); 664 } 665 666 static ParseTree TypeReference(ParseTree p) 667 { 668 if(auto m = tuple("TypeReference",p.end) in memo) 669 return *m; 670 else 671 { 672 ParseTree result = named!(and!(Qualifiedidentifier, option!(and!(Spacing, GenericParameters))), "TypeReference")(p); 673 memo[tuple("TypeReference",p.end)] = result; 674 return result; 675 } 676 } 677 678 static ParseTree TypeReference(string s) 679 { 680 memo = null; 681 return TypeReference(ParseTree("", false,[], s)); 682 } 683 684 static ParseTree TypeSpecification(ParseTree p) 685 { 686 if(auto m = tuple("TypeSpecification",p.end) in memo) 687 return *m; 688 else 689 { 690 ParseTree result = named!(and!(or!(and!(CoreType), and!(TypeReference)), Spacing, option!(NullableType)), "TypeSpecification")(p); 691 memo[tuple("TypeSpecification",p.end)] = result; 692 return result; 693 } 694 } 695 696 static ParseTree TypeSpecification(string s) 697 { 698 memo = null; 699 return TypeSpecification(ParseTree("", false,[], s)); 700 } 701 702 static ParseTree GenericParameters(ParseTree p) 703 { 704 if(auto m = tuple("GenericParameters",p.end) in memo) 705 return *m; 706 else 707 { 708 ParseTree result = named!(and!(literal!("<"), Spacing, Type, zeroOrMore!(and!(Spacing, literal!(","), Spacing, Type)), Spacing, literal!(">")), "GenericParameters")(p); 709 memo[tuple("GenericParameters",p.end)] = result; 710 return result; 711 } 712 } 713 714 static ParseTree GenericParameters(string s) 715 { 716 memo = null; 717 return GenericParameters(ParseTree("", false,[], s)); 718 } 719 720 static ParseTree FunctionType(ParseTree p) 721 { 722 if(auto m = tuple("FunctionType",p.end) in memo) 723 return *m; 724 else 725 { 726 ParseTree result = named!(and!(option!(CallingConvention), Spacing, ParameterTypes, Spacing, option!(NullableType)), "FunctionType")(p); 727 memo[tuple("FunctionType",p.end)] = result; 728 return result; 729 } 730 } 731 732 static ParseTree FunctionType(string s) 733 { 734 memo = null; 735 return FunctionType(ParseTree("", false,[], s)); 736 } 737 738 static ParseTree ParameterTypes(ParseTree p) 739 { 740 if(auto m = tuple("ParameterTypes",p.end) in memo) 741 return *m; 742 else 743 { 744 ParseTree result = named!(and!(literal!("("), Spacing, option!(and!(Type, zeroOrMore!(and!(Spacing, literal!(","), Spacing, Type)))), literal!(")")), "ParameterTypes")(p); 745 memo[tuple("ParameterTypes",p.end)] = result; 746 return result; 747 } 748 } 749 750 static ParseTree ParameterTypes(string s) 751 { 752 memo = null; 753 return ParameterTypes(ParseTree("", false,[], s)); 754 } 755 756 static ParseTree PointerType(ParseTree p) 757 { 758 if(auto m = tuple("PointerType",p.end) in memo) 759 return *m; 760 else 761 { 762 ParseTree result = named!(and!(literal!("*")), "PointerType")(p); 763 memo[tuple("PointerType",p.end)] = result; 764 return result; 765 } 766 } 767 768 static ParseTree PointerType(string s) 769 { 770 memo = null; 771 return PointerType(ParseTree("", false,[], s)); 772 } 773 774 static ParseTree ArrayType(ParseTree p) 775 { 776 if(auto m = tuple("ArrayType",p.end) in memo) 777 return *m; 778 else 779 { 780 ParseTree result = named!(and!(literal!("["), Spacing, literal!("]")), "ArrayType")(p); 781 memo[tuple("ArrayType",p.end)] = result; 782 return result; 783 } 784 } 785 786 static ParseTree ArrayType(string s) 787 { 788 memo = null; 789 return ArrayType(ParseTree("", false,[], s)); 790 } 791 792 static ParseTree VectorType(ParseTree p) 793 { 794 if(auto m = tuple("VectorType",p.end) in memo) 795 return *m; 796 else 797 { 798 ParseTree result = named!(and!(literal!("["), Spacing, Size, Spacing, literal!("]")), "VectorType")(p); 799 memo[tuple("VectorType",p.end)] = result; 800 return result; 801 } 802 } 803 804 static ParseTree VectorType(string s) 805 { 806 memo = null; 807 return VectorType(ParseTree("", false,[], s)); 808 } 809 810 static ParseTree NullableType(ParseTree p) 811 { 812 if(auto m = tuple("NullableType",p.end) in memo) 813 return *m; 814 else 815 { 816 ParseTree result = named!(and!(literal!("?")), "NullableType")(p); 817 memo[tuple("NullableType",p.end)] = result; 818 return result; 819 } 820 } 821 822 static ParseTree NullableType(string s) 823 { 824 memo = null; 825 return NullableType(ParseTree("", false,[], s)); 826 } 827 828 static ParseTree TupleType(ParseTree p) 829 { 830 if(auto m = tuple("TupleType",p.end) in memo) 831 return *m; 832 else 833 { 834 ParseTree result = named!(and!(literal!("{"), Spacing, Type, zeroOrMore!(and!(Spacing, literal!(","), Spacing, Type)), Spacing, literal!("}")), "TupleType")(p); 835 memo[tuple("TupleType",p.end)] = result; 836 return result; 837 } 838 } 839 840 static ParseTree TupleType(string s) 841 { 842 memo = null; 843 return TupleType(ParseTree("", false,[], s)); 844 } 845 846 static ParseTree TypeModifiers(ParseTree p) 847 { 848 if(auto m = tuple("TypeModifiers",p.end) in memo) 849 return *m; 850 else 851 { 852 ParseTree result = named!(and!(oneOrMore!(or!(and!(PointerType), and!(ArrayType), and!(VectorType))), Spacing, option!(NullableType)), "TypeModifiers")(p); 853 memo[tuple("TypeModifiers",p.end)] = result; 854 return result; 855 } 856 } 857 858 static ParseTree TypeModifiers(string s) 859 { 860 memo = null; 861 return TypeModifiers(ParseTree("", false,[], s)); 862 } 863 864 static ParseTree Type(ParseTree p) 865 { 866 if(auto m = tuple("Type",p.end) in memo) 867 return *m; 868 else 869 { 870 ParseTree result = named!(or!(and!(TupleType), and!(TypeSpecification, option!(and!(Spacing, or!(and!(TypeModifiers), and!(FunctionType)))))), "Type")(p); 871 memo[tuple("Type",p.end)] = result; 872 return result; 873 } 874 } 875 876 static ParseTree Type(string s) 877 { 878 memo = null; 879 return Type(ParseTree("", false,[], s)); 880 } 881 882 static ParseTree InferredType(ParseTree p) 883 { 884 if(auto m = tuple("InferredType",p.end) in memo) 885 return *m; 886 else 887 { 888 ParseTree result = named!(or!(and!(literal!("var")), and!(Type)), "InferredType")(p); 889 memo[tuple("InferredType",p.end)] = result; 890 return result; 891 } 892 } 893 894 static ParseTree InferredType(string s) 895 { 896 memo = null; 897 return InferredType(ParseTree("", false,[], s)); 898 } 899 900 static ParseTree ReturnType(ParseTree p) 901 { 902 if(auto m = tuple("ReturnType",p.end) in memo) 903 return *m; 904 else 905 { 906 ParseTree result = named!(or!(and!(literal!("void")), and!(Type)), "ReturnType")(p); 907 memo[tuple("ReturnType",p.end)] = result; 908 return result; 909 } 910 } 911 912 static ParseTree ReturnType(string s) 913 { 914 memo = null; 915 return ReturnType(ParseTree("", false,[], s)); 916 } 917 918 static ParseTree CallingConvention(ParseTree p) 919 { 920 if(auto m = tuple("CallingConvention",p.end) in memo) 921 return *m; 922 else 923 { 924 ParseTree result = named!(or!(and!(literal!("cdecl")), and!(literal!("stdcall"))), "CallingConvention")(p); 925 memo[tuple("CallingConvention",p.end)] = result; 926 return result; 927 } 928 } 929 930 static ParseTree CallingConvention(string s) 931 { 932 memo = null; 933 return CallingConvention(ParseTree("", false,[], s)); 934 } 935 936 static ParseTree Module(ParseTree p) 937 { 938 if(auto m = tuple("Module",p.end) in memo) 939 return *m; 940 else 941 { 942 ParseTree result = named!(and!(literal!("module"), Spacing, Qualifiedidentifier, Spacing, literal!(";")), "Module")(p); 943 memo[tuple("Module",p.end)] = result; 944 return result; 945 } 946 } 947 948 static ParseTree Module(string s) 949 { 950 memo = null; 951 return Module(ParseTree("", false,[], s)); 952 } 953 954 static ParseTree Import(ParseTree p) 955 { 956 if(auto m = tuple("Import",p.end) in memo) 957 return *m; 958 else 959 { 960 ParseTree result = named!(and!(literal!("import"), Spacing, Qualifiedidentifier, zeroOrMore!(and!(Spacing, literal!(","), Spacing, Qualifiedidentifier)), literal!(";")), "Import")(p); 961 memo[tuple("Import",p.end)] = result; 962 return result; 963 } 964 } 965 966 static ParseTree Import(string s) 967 { 968 memo = null; 969 return Import(ParseTree("", false,[], s)); 970 } 971 972 static ParseTree Declaration(ParseTree p) 973 { 974 if(auto m = tuple("Declaration",p.end) in memo) 975 return *m; 976 else 977 { 978 ParseTree result = named!(or!(and!(Import), and!(Class), and!(Interface), and!(Struct), and!(Enum), and!(Data), and!(ModuleConstructor), and!(ModuleFinalizer), and!(Field), and!(ModuleFunction), and!(Operator)), "Declaration")(p); 979 memo[tuple("Declaration",p.end)] = result; 980 return result; 981 } 982 } 983 984 static ParseTree Declaration(string s) 985 { 986 memo = null; 987 return Declaration(ParseTree("", false,[], s)); 988 } 989 990 static ParseTree Visibility(ParseTree p) 991 { 992 if(auto m = tuple("Visibility",p.end) in memo) 993 return *m; 994 else 995 { 996 ParseTree result = named!(or!(and!(literal!("public")), and!(literal!("internal")), and!(literal!("private")), and!(literal!("protected"), option!(and!(or!(and!(literal!("and")), and!(literal!("or"))), literal!("internal"))))), "Visibility")(p); 997 memo[tuple("Visibility",p.end)] = result; 998 return result; 999 } 1000 } 1001 1002 static ParseTree Visibility(string s) 1003 { 1004 memo = null; 1005 return Visibility(ParseTree("", false,[], s)); 1006 } 1007 1008 static ParseTree InheritanceList(ParseTree p) 1009 { 1010 if(auto m = tuple("InheritanceList",p.end) in memo) 1011 return *m; 1012 else 1013 { 1014 ParseTree result = named!(and!(literal!(":"), Spacing, TypeReference, zeroOrMore!(and!(Spacing, literal!(","), Spacing, TypeReference))), "InheritanceList")(p); 1015 memo[tuple("InheritanceList",p.end)] = result; 1016 return result; 1017 } 1018 } 1019 1020 static ParseTree InheritanceList(string s) 1021 { 1022 memo = null; 1023 return InheritanceList(ParseTree("", false,[], s)); 1024 } 1025 1026 static ParseTree Class(ParseTree p) 1027 { 1028 if(auto m = tuple("Class",p.end) in memo) 1029 return *m; 1030 else 1031 { 1032 ParseTree result = named!(and!(option!(Visibility), Spacing, ClassModifiers, Spacing, literal!("class"), Spacing, identifier, Spacing, option!(InheritanceList), literal!("{"), Spacing, zeroOrMore!(and!(ClassMember, Spacing)), Spacing, literal!("}")), "Class")(p); 1033 memo[tuple("Class",p.end)] = result; 1034 return result; 1035 } 1036 } 1037 1038 static ParseTree Class(string s) 1039 { 1040 memo = null; 1041 return Class(ParseTree("", false,[], s)); 1042 } 1043 1044 static ParseTree ClassModifiers(ParseTree p) 1045 { 1046 if(auto m = tuple("ClassModifiers",p.end) in memo) 1047 return *m; 1048 else 1049 { 1050 ParseTree result = named!(and!(option!(or!(and!(literal!("open")), and!(literal!("abstract")))), Spacing, option!(or!(and!(literal!("pure")), and!(literal!("impure")))), Spacing, option!(or!(and!(literal!("safe")), and!(literal!("unsafe"))))), "ClassModifiers")(p); 1051 memo[tuple("ClassModifiers",p.end)] = result; 1052 return result; 1053 } 1054 } 1055 1056 static ParseTree ClassModifiers(string s) 1057 { 1058 memo = null; 1059 return ClassModifiers(ParseTree("", false,[], s)); 1060 } 1061 1062 static ParseTree ClassMember(ParseTree p) 1063 { 1064 if(auto m = tuple("ClassMember",p.end) in memo) 1065 return *m; 1066 else 1067 { 1068 ParseTree result = named!(or!(and!(ClassConstructor), and!(ClassFinalizer), and!(Constructor), and!(Finalizer), and!(Field), and!(Property), and!(Method), and!(Operator)), "ClassMember")(p); 1069 memo[tuple("ClassMember",p.end)] = result; 1070 return result; 1071 } 1072 } 1073 1074 static ParseTree ClassMember(string s) 1075 { 1076 memo = null; 1077 return ClassMember(ParseTree("", false,[], s)); 1078 } 1079 1080 static ParseTree Interface(ParseTree p) 1081 { 1082 if(auto m = tuple("Interface",p.end) in memo) 1083 return *m; 1084 else 1085 { 1086 ParseTree result = named!(and!(option!(Visibility), Spacing, literal!("interface"), Spacing, identifier, Spacing, option!(InheritanceList), Spacing, literal!("{"), Spacing, zeroOrMore!(and!(InterfaceMember, Spacing)), Spacing, literal!("}")), "Interface")(p); 1087 memo[tuple("Interface",p.end)] = result; 1088 return result; 1089 } 1090 } 1091 1092 static ParseTree Interface(string s) 1093 { 1094 memo = null; 1095 return Interface(ParseTree("", false,[], s)); 1096 } 1097 1098 static ParseTree InterfaceMember(ParseTree p) 1099 { 1100 if(auto m = tuple("InterfaceMember",p.end) in memo) 1101 return *m; 1102 else 1103 { 1104 ParseTree result = named!(or!(and!(Property), and!(Method), and!(Operator)), "InterfaceMember")(p); 1105 memo[tuple("InterfaceMember",p.end)] = result; 1106 return result; 1107 } 1108 } 1109 1110 static ParseTree InterfaceMember(string s) 1111 { 1112 memo = null; 1113 return InterfaceMember(ParseTree("", false,[], s)); 1114 } 1115 1116 static ParseTree Struct(ParseTree p) 1117 { 1118 if(auto m = tuple("Struct",p.end) in memo) 1119 return *m; 1120 else 1121 { 1122 ParseTree result = named!(and!(option!(Visibility), Spacing, StructModifiers, Spacing, literal!("struct"), Spacing, identifier, Spacing, option!(InheritanceList), Spacing, literal!("{"), Spacing, zeroOrMore!(and!(StructMember, Spacing)), Spacing, literal!("}")), "Struct")(p); 1123 memo[tuple("Struct",p.end)] = result; 1124 return result; 1125 } 1126 } 1127 1128 static ParseTree Struct(string s) 1129 { 1130 memo = null; 1131 return Struct(ParseTree("", false,[], s)); 1132 } 1133 1134 static ParseTree StructModifiers(ParseTree p) 1135 { 1136 if(auto m = tuple("StructModifiers",p.end) in memo) 1137 return *m; 1138 else 1139 { 1140 ParseTree result = named!(and!(option!(or!(and!(literal!("pure")), and!(literal!("impure")))), Spacing, option!(or!(and!(literal!("safe")), and!(literal!("unsafe"))))), "StructModifiers")(p); 1141 memo[tuple("StructModifiers",p.end)] = result; 1142 return result; 1143 } 1144 } 1145 1146 static ParseTree StructModifiers(string s) 1147 { 1148 memo = null; 1149 return StructModifiers(ParseTree("", false,[], s)); 1150 } 1151 1152 static ParseTree StructMember(ParseTree p) 1153 { 1154 if(auto m = tuple("StructMember",p.end) in memo) 1155 return *m; 1156 else 1157 { 1158 ParseTree result = named!(or!(and!(StructConstructor), and!(StructFinalizer), and!(Constructor), and!(Field), and!(Property), and!(Function), and!(Operator)), "StructMember")(p); 1159 memo[tuple("StructMember",p.end)] = result; 1160 return result; 1161 } 1162 } 1163 1164 static ParseTree StructMember(string s) 1165 { 1166 memo = null; 1167 return StructMember(ParseTree("", false,[], s)); 1168 } 1169 1170 static ParseTree Enum(ParseTree p) 1171 { 1172 if(auto m = tuple("Enum",p.end) in memo) 1173 return *m; 1174 else 1175 { 1176 ParseTree result = named!(and!(option!(Visibility), Spacing, literal!("enum"), Spacing, identifier, Spacing, EnumBase, Spacing, literal!("{"), Spacing, zeroOrMore!(and!(EnumMember, Spacing)), Spacing, literal!("}")), "Enum")(p); 1177 memo[tuple("Enum",p.end)] = result; 1178 return result; 1179 } 1180 } 1181 1182 static ParseTree Enum(string s) 1183 { 1184 memo = null; 1185 return Enum(ParseTree("", false,[], s)); 1186 } 1187 1188 static ParseTree EnumBase(ParseTree p) 1189 { 1190 if(auto m = tuple("EnumBase",p.end) in memo) 1191 return *m; 1192 else 1193 { 1194 ParseTree result = named!(and!(literal!("of"), Spacing, FixedIntegralType), "EnumBase")(p); 1195 memo[tuple("EnumBase",p.end)] = result; 1196 return result; 1197 } 1198 } 1199 1200 static ParseTree EnumBase(string s) 1201 { 1202 memo = null; 1203 return EnumBase(ParseTree("", false,[], s)); 1204 } 1205 1206 static ParseTree EnumMember(ParseTree p) 1207 { 1208 if(auto m = tuple("EnumMember",p.end) in memo) 1209 return *m; 1210 else 1211 { 1212 ParseTree result = named!(and!(identifier, zeroOrMore!(and!(Spacing, literal!(","), Spacing, identifier)), Spacing, literal!("="), Spacing, Size, Spacing, literal!(";")), "EnumMember")(p); 1213 memo[tuple("EnumMember",p.end)] = result; 1214 return result; 1215 } 1216 } 1217 1218 static ParseTree EnumMember(string s) 1219 { 1220 memo = null; 1221 return EnumMember(ParseTree("", false,[], s)); 1222 } 1223 1224 static ParseTree Data(ParseTree p) 1225 { 1226 if(auto m = tuple("Data",p.end) in memo) 1227 return *m; 1228 else 1229 { 1230 ParseTree result = named!(and!(option!(Visibility), Spacing, literal!("data"), Spacing, DataSemantics, Spacing, identifier, Spacing, literal!("{"), Spacing, zeroOrMore!(and!(DataMember, Spacing)), Spacing, literal!("}")), "Data")(p); 1231 memo[tuple("Data",p.end)] = result; 1232 return result; 1233 } 1234 } 1235 1236 static ParseTree Data(string s) 1237 { 1238 memo = null; 1239 return Data(ParseTree("", false,[], s)); 1240 } 1241 1242 static ParseTree DataSemantics(ParseTree p) 1243 { 1244 if(auto m = tuple("DataSemantics",p.end) in memo) 1245 return *m; 1246 else 1247 { 1248 ParseTree result = named!(or!(and!(literal!("byref")), and!(literal!("byval"))), "DataSemantics")(p); 1249 memo[tuple("DataSemantics",p.end)] = result; 1250 return result; 1251 } 1252 } 1253 1254 static ParseTree DataSemantics(string s) 1255 { 1256 memo = null; 1257 return DataSemantics(ParseTree("", false,[], s)); 1258 } 1259 1260 static ParseTree DataMember(ParseTree p) 1261 { 1262 if(auto m = tuple("DataMember",p.end) in memo) 1263 return *m; 1264 else 1265 { 1266 ParseTree result = named!(or!(and!(DataField), and!(DataCase), and!(Property), and!(Function), and!(Operator)), "DataMember")(p); 1267 memo[tuple("DataMember",p.end)] = result; 1268 return result; 1269 } 1270 } 1271 1272 static ParseTree DataMember(string s) 1273 { 1274 memo = null; 1275 return DataMember(ParseTree("", false,[], s)); 1276 } 1277 1278 static ParseTree DataField(ParseTree p) 1279 { 1280 if(auto m = tuple("DataField",p.end) in memo) 1281 return *m; 1282 else 1283 { 1284 ParseTree result = named!(and!(Type, Spacing, identifier, zeroOrMore!(and!(Spacing, literal!(","), Spacing, identifier)), Spacing, literal!(";")), "DataField")(p); 1285 memo[tuple("DataField",p.end)] = result; 1286 return result; 1287 } 1288 } 1289 1290 static ParseTree DataField(string s) 1291 { 1292 memo = null; 1293 return DataField(ParseTree("", false,[], s)); 1294 } 1295 1296 static ParseTree DataCase(ParseTree p) 1297 { 1298 if(auto m = tuple("DataCase",p.end) in memo) 1299 return *m; 1300 else 1301 { 1302 ParseTree result = named!(and!(literal!("case"), Spacing, identifier, literal!("{"), Spacing, zeroOrMore!(and!(DataField, Spacing)), Spacing, literal!("}")), "DataCase")(p); 1303 memo[tuple("DataCase",p.end)] = result; 1304 return result; 1305 } 1306 } 1307 1308 static ParseTree DataCase(string s) 1309 { 1310 memo = null; 1311 return DataCase(ParseTree("", false,[], s)); 1312 } 1313 1314 static ParseTree StaticConstructorModifiers(ParseTree p) 1315 { 1316 if(auto m = tuple("StaticConstructorModifiers",p.end) in memo) 1317 return *m; 1318 else 1319 { 1320 ParseTree result = named!(and!(option!(literal!("thread")), Spacing, option!(or!(and!(literal!("pure")), and!(literal!("impure")))), Spacing, option!(or!(and!(literal!("safe")), and!(literal!("unsafe"))))), "StaticConstructorModifiers")(p); 1321 memo[tuple("StaticConstructorModifiers",p.end)] = result; 1322 return result; 1323 } 1324 } 1325 1326 static ParseTree StaticConstructorModifiers(string s) 1327 { 1328 memo = null; 1329 return StaticConstructorModifiers(ParseTree("", false,[], s)); 1330 } 1331 1332 static ParseTree StaticConstructorBody(ParseTree p) 1333 { 1334 if(auto m = tuple("StaticConstructorBody",p.end) in memo) 1335 return *m; 1336 else 1337 { 1338 ParseTree result = named!(and!(BlockStatement), "StaticConstructorBody")(p); 1339 memo[tuple("StaticConstructorBody",p.end)] = result; 1340 return result; 1341 } 1342 } 1343 1344 static ParseTree StaticConstructorBody(string s) 1345 { 1346 memo = null; 1347 return StaticConstructorBody(ParseTree("", false,[], s)); 1348 } 1349 1350 static ParseTree ModuleConstructor(ParseTree p) 1351 { 1352 if(auto m = tuple("ModuleConstructor",p.end) in memo) 1353 return *m; 1354 else 1355 { 1356 ParseTree result = named!(and!(StaticConstructorModifiers, Spacing, literal!("module"), Spacing, literal!("("), Spacing, literal!(")"), Spacing, StaticConstructorBody), "ModuleConstructor")(p); 1357 memo[tuple("ModuleConstructor",p.end)] = result; 1358 return result; 1359 } 1360 } 1361 1362 static ParseTree ModuleConstructor(string s) 1363 { 1364 memo = null; 1365 return ModuleConstructor(ParseTree("", false,[], s)); 1366 } 1367 1368 static ParseTree ModuleFinalizer(ParseTree p) 1369 { 1370 if(auto m = tuple("ModuleFinalizer",p.end) in memo) 1371 return *m; 1372 else 1373 { 1374 ParseTree result = named!(and!(StaticConstructorModifiers, Spacing, literal!("~"), Spacing, literal!("module"), Spacing, EmptyParameterList, Spacing, StaticConstructorBody), "ModuleFinalizer")(p); 1375 memo[tuple("ModuleFinalizer",p.end)] = result; 1376 return result; 1377 } 1378 } 1379 1380 static ParseTree ModuleFinalizer(string s) 1381 { 1382 memo = null; 1383 return ModuleFinalizer(ParseTree("", false,[], s)); 1384 } 1385 1386 static ParseTree ClassConstructor(ParseTree p) 1387 { 1388 if(auto m = tuple("ClassConstructor",p.end) in memo) 1389 return *m; 1390 else 1391 { 1392 ParseTree result = named!(and!(StaticConstructorModifiers, Spacing, literal!("class"), Spacing, literal!("("), Spacing, literal!(")"), Spacing, StaticConstructorBody), "ClassConstructor")(p); 1393 memo[tuple("ClassConstructor",p.end)] = result; 1394 return result; 1395 } 1396 } 1397 1398 static ParseTree ClassConstructor(string s) 1399 { 1400 memo = null; 1401 return ClassConstructor(ParseTree("", false,[], s)); 1402 } 1403 1404 static ParseTree ClassFinalizer(ParseTree p) 1405 { 1406 if(auto m = tuple("ClassFinalizer",p.end) in memo) 1407 return *m; 1408 else 1409 { 1410 ParseTree result = named!(and!(StaticConstructorModifiers, Spacing, literal!("~"), Spacing, literal!("class"), Spacing, EmptyParameterList, Spacing, StaticConstructorBody), "ClassFinalizer")(p); 1411 memo[tuple("ClassFinalizer",p.end)] = result; 1412 return result; 1413 } 1414 } 1415 1416 static ParseTree ClassFinalizer(string s) 1417 { 1418 memo = null; 1419 return ClassFinalizer(ParseTree("", false,[], s)); 1420 } 1421 1422 static ParseTree StructConstructor(ParseTree p) 1423 { 1424 if(auto m = tuple("StructConstructor",p.end) in memo) 1425 return *m; 1426 else 1427 { 1428 ParseTree result = named!(and!(StaticConstructorModifiers, Spacing, literal!("struct"), Spacing, literal!("("), Spacing, literal!(")"), Spacing, StaticConstructorBody), "StructConstructor")(p); 1429 memo[tuple("StructConstructor",p.end)] = result; 1430 return result; 1431 } 1432 } 1433 1434 static ParseTree StructConstructor(string s) 1435 { 1436 memo = null; 1437 return StructConstructor(ParseTree("", false,[], s)); 1438 } 1439 1440 static ParseTree StructFinalizer(ParseTree p) 1441 { 1442 if(auto m = tuple("StructFinalizer",p.end) in memo) 1443 return *m; 1444 else 1445 { 1446 ParseTree result = named!(and!(StaticConstructorModifiers, Spacing, literal!("~"), Spacing, literal!("struct"), Spacing, EmptyParameterList, Spacing, StaticConstructorBody), "StructFinalizer")(p); 1447 memo[tuple("StructFinalizer",p.end)] = result; 1448 return result; 1449 } 1450 } 1451 1452 static ParseTree StructFinalizer(string s) 1453 { 1454 memo = null; 1455 return StructFinalizer(ParseTree("", false,[], s)); 1456 } 1457 1458 static ParseTree Field(ParseTree p) 1459 { 1460 if(auto m = tuple("Field",p.end) in memo) 1461 return *m; 1462 else 1463 { 1464 ParseTree result = named!(and!(option!(Visibility), Spacing, FieldModifiers, Spacing, Type, Spacing, identifier, zeroOrMore!(and!(Spacing, literal!(","), Spacing, identifier)), Spacing, literal!(";")), "Field")(p); 1465 memo[tuple("Field",p.end)] = result; 1466 return result; 1467 } 1468 } 1469 1470 static ParseTree Field(string s) 1471 { 1472 memo = null; 1473 return Field(ParseTree("", false,[], s)); 1474 } 1475 1476 static ParseTree FieldModifiers(ParseTree p) 1477 { 1478 if(auto m = tuple("FieldModifiers",p.end) in memo) 1479 return *m; 1480 else 1481 { 1482 ParseTree result = named!(or!(and!(literal!("const")), and!(option!(or!(and!(literal!("thread")), and!(literal!("static")))), Spacing, option!(literal!("final")))), "FieldModifiers")(p); 1483 memo[tuple("FieldModifiers",p.end)] = result; 1484 return result; 1485 } 1486 } 1487 1488 static ParseTree FieldModifiers(string s) 1489 { 1490 memo = null; 1491 return FieldModifiers(ParseTree("", false,[], s)); 1492 } 1493 1494 static ParseTree ModuleFunction(ParseTree p) 1495 { 1496 if(auto m = tuple("ModuleFunction",p.end) in memo) 1497 return *m; 1498 else 1499 { 1500 ParseTree result = named!(or!(and!(RawFunction), and!(ExternFunction), and!(Function)), "ModuleFunction")(p); 1501 memo[tuple("ModuleFunction",p.end)] = result; 1502 return result; 1503 } 1504 } 1505 1506 static ParseTree ModuleFunction(string s) 1507 { 1508 memo = null; 1509 return ModuleFunction(ParseTree("", false,[], s)); 1510 } 1511 1512 static ParseTree RawFunction(ParseTree p) 1513 { 1514 if(auto m = tuple("RawFunction",p.end) in memo) 1515 return *m; 1516 else 1517 { 1518 ParseTree result = named!(and!(option!(Visibility), Spacing, literal!("raw"), Spacing, ReturnType, Spacing, identifier, Spacing, ParameterList, Spacing, RawFunctionBody), "RawFunction")(p); 1519 memo[tuple("RawFunction",p.end)] = result; 1520 return result; 1521 } 1522 } 1523 1524 static ParseTree RawFunction(string s) 1525 { 1526 memo = null; 1527 return RawFunction(ParseTree("", false,[], s)); 1528 } 1529 1530 static ParseTree RawFunctionBody(ParseTree p) 1531 { 1532 if(auto m = tuple("RawFunctionBody",p.end) in memo) 1533 return *m; 1534 else 1535 { 1536 ParseTree result = named!(and!(BlockStatement), "RawFunctionBody")(p); 1537 memo[tuple("RawFunctionBody",p.end)] = result; 1538 return result; 1539 } 1540 } 1541 1542 static ParseTree RawFunctionBody(string s) 1543 { 1544 memo = null; 1545 return RawFunctionBody(ParseTree("", false,[], s)); 1546 } 1547 1548 static ParseTree ExternFunction(ParseTree p) 1549 { 1550 if(auto m = tuple("ExternFunction",p.end) in memo) 1551 return *m; 1552 else 1553 { 1554 ParseTree result = named!(and!(option!(Visibility), Spacing, literal!("extern"), Spacing, ExternFunctionLocation, Spacing, ReturnType, Spacing, identifier, Spacing, ParameterList, Spacing, literal!(";")), "ExternFunction")(p); 1555 memo[tuple("ExternFunction",p.end)] = result; 1556 return result; 1557 } 1558 } 1559 1560 static ParseTree ExternFunction(string s) 1561 { 1562 memo = null; 1563 return ExternFunction(ParseTree("", false,[], s)); 1564 } 1565 1566 static ParseTree ExternFunctionLocation(ParseTree p) 1567 { 1568 if(auto m = tuple("ExternFunctionLocation",p.end) in memo) 1569 return *m; 1570 else 1571 { 1572 ParseTree result = named!(and!(literal!("("), Spacing, String, Spacing, literal!(","), Spacing, String, Spacing, literal!(")")), "ExternFunctionLocation")(p); 1573 memo[tuple("ExternFunctionLocation",p.end)] = result; 1574 return result; 1575 } 1576 } 1577 1578 static ParseTree ExternFunctionLocation(string s) 1579 { 1580 memo = null; 1581 return ExternFunctionLocation(ParseTree("", false,[], s)); 1582 } 1583 1584 static ParseTree Function(ParseTree p) 1585 { 1586 if(auto m = tuple("Function",p.end) in memo) 1587 return *m; 1588 else 1589 { 1590 ParseTree result = named!(and!(option!(Visibility), Spacing, FunctionModifiers, Spacing, ReturnType, Spacing, identifier, Spacing, ParameterList, Spacing, FunctionBody), "Function")(p); 1591 memo[tuple("Function",p.end)] = result; 1592 return result; 1593 } 1594 } 1595 1596 static ParseTree Function(string s) 1597 { 1598 memo = null; 1599 return Function(ParseTree("", false,[], s)); 1600 } 1601 1602 static ParseTree FunctionModifiers(ParseTree p) 1603 { 1604 if(auto m = tuple("FunctionModifiers",p.end) in memo) 1605 return *m; 1606 else 1607 { 1608 ParseTree result = named!(and!(option!(or!(and!(literal!("pure")), and!(literal!("impure")))), Spacing, option!(or!(and!(literal!("safe")), and!(literal!("unsafe"))))), "FunctionModifiers")(p); 1609 memo[tuple("FunctionModifiers",p.end)] = result; 1610 return result; 1611 } 1612 } 1613 1614 static ParseTree FunctionModifiers(string s) 1615 { 1616 memo = null; 1617 return FunctionModifiers(ParseTree("", false,[], s)); 1618 } 1619 1620 static ParseTree FunctionBody(ParseTree p) 1621 { 1622 if(auto m = tuple("FunctionBody",p.end) in memo) 1623 return *m; 1624 else 1625 { 1626 ParseTree result = named!(and!(BlockStatement), "FunctionBody")(p); 1627 memo[tuple("FunctionBody",p.end)] = result; 1628 return result; 1629 } 1630 } 1631 1632 static ParseTree FunctionBody(string s) 1633 { 1634 memo = null; 1635 return FunctionBody(ParseTree("", false,[], s)); 1636 } 1637 1638 static ParseTree EmptyParameterList(ParseTree p) 1639 { 1640 if(auto m = tuple("EmptyParameterList",p.end) in memo) 1641 return *m; 1642 else 1643 { 1644 ParseTree result = named!(and!(literal!("("), Spacing, literal!(")")), "EmptyParameterList")(p); 1645 memo[tuple("EmptyParameterList",p.end)] = result; 1646 return result; 1647 } 1648 } 1649 1650 static ParseTree EmptyParameterList(string s) 1651 { 1652 memo = null; 1653 return EmptyParameterList(ParseTree("", false,[], s)); 1654 } 1655 1656 static ParseTree ParameterList(ParseTree p) 1657 { 1658 if(auto m = tuple("ParameterList",p.end) in memo) 1659 return *m; 1660 else 1661 { 1662 ParseTree result = named!(and!(literal!("("), Spacing, option!(and!(Parameter, zeroOrMore!(and!(Spacing, literal!(","), Spacing, Parameter)))), Spacing, literal!(")")), "ParameterList")(p); 1663 memo[tuple("ParameterList",p.end)] = result; 1664 return result; 1665 } 1666 } 1667 1668 static ParseTree ParameterList(string s) 1669 { 1670 memo = null; 1671 return ParameterList(ParseTree("", false,[], s)); 1672 } 1673 1674 static ParseTree Parameter(ParseTree p) 1675 { 1676 if(auto m = tuple("Parameter",p.end) in memo) 1677 return *m; 1678 else 1679 { 1680 ParseTree result = named!(and!(ParameterModifiers, Spacing, Type, Spacing, identifier), "Parameter")(p); 1681 memo[tuple("Parameter",p.end)] = result; 1682 return result; 1683 } 1684 } 1685 1686 static ParseTree Parameter(string s) 1687 { 1688 memo = null; 1689 return Parameter(ParseTree("", false,[], s)); 1690 } 1691 1692 static ParseTree ParameterModifiers(ParseTree p) 1693 { 1694 if(auto m = tuple("ParameterModifiers",p.end) in memo) 1695 return *m; 1696 else 1697 { 1698 ParseTree result = named!(and!(option!(or!(and!(literal!("ref")), and!(literal!("out")), and!(literal!("params"))))), "ParameterModifiers")(p); 1699 memo[tuple("ParameterModifiers",p.end)] = result; 1700 return result; 1701 } 1702 } 1703 1704 static ParseTree ParameterModifiers(string s) 1705 { 1706 memo = null; 1707 return ParameterModifiers(ParseTree("", false,[], s)); 1708 } 1709 1710 static ParseTree Operator(ParseTree p) 1711 { 1712 if(auto m = tuple("Operator",p.end) in memo) 1713 return *m; 1714 else 1715 { 1716 ParseTree result = named!(and!(option!(Visibility), Spacing, Type, Spacing, literal!("operator"), Spacing, CustomOperator, Spacing, ParameterList, Spacing, OperatorBody), "Operator")(p); 1717 memo[tuple("Operator",p.end)] = result; 1718 return result; 1719 } 1720 } 1721 1722 static ParseTree Operator(string s) 1723 { 1724 memo = null; 1725 return Operator(ParseTree("", false,[], s)); 1726 } 1727 1728 static ParseTree CustomOperator(ParseTree p) 1729 { 1730 if(auto m = tuple("CustomOperator",p.end) in memo) 1731 return *m; 1732 else 1733 { 1734 ParseTree result = named!(or!(and!(literal!("+")), and!(literal!("-")), and!(literal!("*")), and!(slash), and!(literal!("%")), and!(literal!("&")), and!(literal!("|")), and!(literal!("^"))), "CustomOperator")(p); 1735 memo[tuple("CustomOperator",p.end)] = result; 1736 return result; 1737 } 1738 } 1739 1740 static ParseTree CustomOperator(string s) 1741 { 1742 memo = null; 1743 return CustomOperator(ParseTree("", false,[], s)); 1744 } 1745 1746 static ParseTree OperatorBody(ParseTree p) 1747 { 1748 if(auto m = tuple("OperatorBody",p.end) in memo) 1749 return *m; 1750 else 1751 { 1752 ParseTree result = named!(and!(BlockStatement), "OperatorBody")(p); 1753 memo[tuple("OperatorBody",p.end)] = result; 1754 return result; 1755 } 1756 } 1757 1758 static ParseTree OperatorBody(string s) 1759 { 1760 memo = null; 1761 return OperatorBody(ParseTree("", false,[], s)); 1762 } 1763 1764 static ParseTree Property(ParseTree p) 1765 { 1766 if(auto m = tuple("Property",p.end) in memo) 1767 return *m; 1768 else 1769 { 1770 ParseTree result = named!(and!(option!(Visibility), Spacing, PropertyModifiers, Spacing, Type, Spacing, identifier, Spacing, literal!("{"), Spacing, PropertyBody, Spacing, literal!("}")), "Property")(p); 1771 memo[tuple("Property",p.end)] = result; 1772 return result; 1773 } 1774 } 1775 1776 static ParseTree Property(string s) 1777 { 1778 memo = null; 1779 return Property(ParseTree("", false,[], s)); 1780 } 1781 1782 static ParseTree PropertyModifiers(ParseTree p) 1783 { 1784 if(auto m = tuple("PropertyModifiers",p.end) in memo) 1785 return *m; 1786 else 1787 { 1788 ParseTree result = named!(and!(option!(or!(and!(literal!("pure")), and!(literal!("impure")))), Spacing, option!(or!(and!(literal!("safe")), and!(literal!("unsafe")))), Spacing, or!(and!(or!(and!(literal!("virtual")), and!(literal!("abstract")))), and!(option!(literal!("override")), Spacing, option!(literal!("final"))))), "PropertyModifiers")(p); 1789 memo[tuple("PropertyModifiers",p.end)] = result; 1790 return result; 1791 } 1792 } 1793 1794 static ParseTree PropertyModifiers(string s) 1795 { 1796 memo = null; 1797 return PropertyModifiers(ParseTree("", false,[], s)); 1798 } 1799 1800 static ParseTree PropertyBody(ParseTree p) 1801 { 1802 if(auto m = tuple("PropertyBody",p.end) in memo) 1803 return *m; 1804 else 1805 { 1806 ParseTree result = named!(or!(and!(PropertyGetter, Spacing, PropertySetter), and!(PropertyGetter), and!(PropertySetter)), "PropertyBody")(p); 1807 memo[tuple("PropertyBody",p.end)] = result; 1808 return result; 1809 } 1810 } 1811 1812 static ParseTree PropertyBody(string s) 1813 { 1814 memo = null; 1815 return PropertyBody(ParseTree("", false,[], s)); 1816 } 1817 1818 static ParseTree PropertyGetter(ParseTree p) 1819 { 1820 if(auto m = tuple("PropertyGetter",p.end) in memo) 1821 return *m; 1822 else 1823 { 1824 ParseTree result = named!(and!(AccessorModifiers, Spacing, literal!("get"), Spacing, AccessorBody), "PropertyGetter")(p); 1825 memo[tuple("PropertyGetter",p.end)] = result; 1826 return result; 1827 } 1828 } 1829 1830 static ParseTree PropertyGetter(string s) 1831 { 1832 memo = null; 1833 return PropertyGetter(ParseTree("", false,[], s)); 1834 } 1835 1836 static ParseTree PropertySetter(ParseTree p) 1837 { 1838 if(auto m = tuple("PropertySetter",p.end) in memo) 1839 return *m; 1840 else 1841 { 1842 ParseTree result = named!(and!(AccessorModifiers, Spacing, literal!("set"), Spacing, AccessorBody), "PropertySetter")(p); 1843 memo[tuple("PropertySetter",p.end)] = result; 1844 return result; 1845 } 1846 } 1847 1848 static ParseTree PropertySetter(string s) 1849 { 1850 memo = null; 1851 return PropertySetter(ParseTree("", false,[], s)); 1852 } 1853 1854 static ParseTree AccessorModifiers(ParseTree p) 1855 { 1856 if(auto m = tuple("AccessorModifiers",p.end) in memo) 1857 return *m; 1858 else 1859 { 1860 ParseTree result = named!(and!(option!(or!(and!(literal!("pure")), and!(literal!("impure")))), Spacing, option!(or!(and!(literal!("safe")), and!(literal!("unsafe"))))), "AccessorModifiers")(p); 1861 memo[tuple("AccessorModifiers",p.end)] = result; 1862 return result; 1863 } 1864 } 1865 1866 static ParseTree AccessorModifiers(string s) 1867 { 1868 memo = null; 1869 return AccessorModifiers(ParseTree("", false,[], s)); 1870 } 1871 1872 static ParseTree AccessorBody(ParseTree p) 1873 { 1874 if(auto m = tuple("AccessorBody",p.end) in memo) 1875 return *m; 1876 else 1877 { 1878 ParseTree result = named!(or!(and!(BlockStatement), and!(literal!(";"))), "AccessorBody")(p); 1879 memo[tuple("AccessorBody",p.end)] = result; 1880 return result; 1881 } 1882 } 1883 1884 static ParseTree AccessorBody(string s) 1885 { 1886 memo = null; 1887 return AccessorBody(ParseTree("", false,[], s)); 1888 } 1889 1890 static ParseTree Method(ParseTree p) 1891 { 1892 if(auto m = tuple("Method",p.end) in memo) 1893 return *m; 1894 else 1895 { 1896 ParseTree result = named!(and!(option!(Visibility), Spacing, MethodModifiers, Spacing, ReturnType, Spacing, identifier, Spacing, ParameterList, Spacing, MethodBody), "Method")(p); 1897 memo[tuple("Method",p.end)] = result; 1898 return result; 1899 } 1900 } 1901 1902 static ParseTree Method(string s) 1903 { 1904 memo = null; 1905 return Method(ParseTree("", false,[], s)); 1906 } 1907 1908 static ParseTree MethodModifiers(ParseTree p) 1909 { 1910 if(auto m = tuple("MethodModifiers",p.end) in memo) 1911 return *m; 1912 else 1913 { 1914 ParseTree result = named!(and!(option!(or!(and!(literal!("pure")), and!(literal!("impure")))), Spacing, option!(or!(and!(literal!("safe")), and!(literal!("unsafe")))), Spacing, or!(and!(or!(and!(literal!("virtual")), and!(literal!("abstract")))), and!(option!(literal!("override")), Spacing, option!(literal!("final"))))), "MethodModifiers")(p); 1915 memo[tuple("MethodModifiers",p.end)] = result; 1916 return result; 1917 } 1918 } 1919 1920 static ParseTree MethodModifiers(string s) 1921 { 1922 memo = null; 1923 return MethodModifiers(ParseTree("", false,[], s)); 1924 } 1925 1926 static ParseTree MethodBody(ParseTree p) 1927 { 1928 if(auto m = tuple("MethodBody",p.end) in memo) 1929 return *m; 1930 else 1931 { 1932 ParseTree result = named!(or!(and!(BlockStatement), and!(literal!(";"))), "MethodBody")(p); 1933 memo[tuple("MethodBody",p.end)] = result; 1934 return result; 1935 } 1936 } 1937 1938 static ParseTree MethodBody(string s) 1939 { 1940 memo = null; 1941 return MethodBody(ParseTree("", false,[], s)); 1942 } 1943 1944 static ParseTree Constructor(ParseTree p) 1945 { 1946 if(auto m = tuple("Constructor",p.end) in memo) 1947 return *m; 1948 else 1949 { 1950 ParseTree result = named!(and!(option!(Visibility), Spacing, literal!("this"), Spacing, ParameterList, Spacing, FunctionBody), "Constructor")(p); 1951 memo[tuple("Constructor",p.end)] = result; 1952 return result; 1953 } 1954 } 1955 1956 static ParseTree Constructor(string s) 1957 { 1958 memo = null; 1959 return Constructor(ParseTree("", false,[], s)); 1960 } 1961 1962 static ParseTree Finalizer(ParseTree p) 1963 { 1964 if(auto m = tuple("Finalizer",p.end) in memo) 1965 return *m; 1966 else 1967 { 1968 ParseTree result = named!(and!(literal!("~"), Spacing, literal!("this"), Spacing, EmptyParameterList, Spacing, FunctionBody), "Finalizer")(p); 1969 memo[tuple("Finalizer",p.end)] = result; 1970 return result; 1971 } 1972 } 1973 1974 static ParseTree Finalizer(string s) 1975 { 1976 memo = null; 1977 return Finalizer(ParseTree("", false,[], s)); 1978 } 1979 1980 static ParseTree BlockStatement(ParseTree p) 1981 { 1982 if(auto m = tuple("BlockStatement",p.end) in memo) 1983 return *m; 1984 else 1985 { 1986 ParseTree result = named!(and!(literal!("{"), Spacing, literal!("}")), "BlockStatement")(p); 1987 memo[tuple("BlockStatement",p.end)] = result; 1988 return result; 1989 } 1990 } 1991 1992 static ParseTree BlockStatement(string s) 1993 { 1994 memo = null; 1995 return BlockStatement(ParseTree("", false,[], s)); 1996 } 1997 1998 static ParseTree opCall(ParseTree p) 1999 { 2000 ParseTree result = decimateTree(Program(p)); 2001 result.children = [result]; 2002 result.name = "Cursive"; 2003 return result; 2004 } 2005 2006 static ParseTree opCall(string input) 2007 { 2008 memo = null; 2009 return Cursive(ParseTree(``, false, [], input, 0, 0)); 2010 } 2011 } 2012