github.com/jxskiss/gopkg@v0.17.3/json/extparser/json.peg.go (about) 1 package extparser 2 3 // Code generated by peg json.peg DO NOT EDIT. 4 5 import ( 6 "fmt" 7 "io" 8 "os" 9 "sort" 10 "strconv" 11 "strings" 12 ) 13 14 const endSymbol rune = 1114112 15 16 /* The rule types inferred from the grammar are below. */ 17 type pegRule uint8 18 19 const ( 20 ruleUnknown pegRule = iota 21 ruleDocument 22 ruleJSON 23 ruleObject 24 ruleObjectKey 25 ruleArray 26 ruleImport 27 ruleSimpleIdentifier 28 ruleString 29 ruleSingleQuoteLiteral 30 ruleDoubleQuoteLiteral 31 ruleSingleQuoteEscape 32 ruleDoubleQuoteEscape 33 ruleUnicodeEscape 34 ruleHexDigit 35 ruleTrue 36 ruleFalse 37 ruleNull 38 ruleNumber 39 ruleMinus 40 ruleIntegralPart 41 ruleFractionalPart 42 ruleExponentPart 43 ruleSpacing 44 ruleWhitespace 45 ruleLongComment 46 ruleLineComment 47 rulePragma 48 ruleLWING 49 ruleRWING 50 ruleLBRK 51 ruleRBRK 52 ruleCOMMA 53 ruleCOLON 54 ruleEOT 55 ) 56 57 var rul3s = [...]string{ 58 "Unknown", 59 "Document", 60 "JSON", 61 "Object", 62 "ObjectKey", 63 "Array", 64 "Import", 65 "SimpleIdentifier", 66 "String", 67 "SingleQuoteLiteral", 68 "DoubleQuoteLiteral", 69 "SingleQuoteEscape", 70 "DoubleQuoteEscape", 71 "UnicodeEscape", 72 "HexDigit", 73 "True", 74 "False", 75 "Null", 76 "Number", 77 "Minus", 78 "IntegralPart", 79 "FractionalPart", 80 "ExponentPart", 81 "Spacing", 82 "Whitespace", 83 "LongComment", 84 "LineComment", 85 "Pragma", 86 "LWING", 87 "RWING", 88 "LBRK", 89 "RBRK", 90 "COMMA", 91 "COLON", 92 "EOT", 93 } 94 95 type token32 struct { 96 pegRule 97 begin, end uint32 98 } 99 100 func (t *token32) String() string { 101 return fmt.Sprintf("\x1B[34m%v\x1B[m %v %v", rul3s[t.pegRule], t.begin, t.end) 102 } 103 104 type node32 struct { 105 token32 106 up, next *node32 107 } 108 109 func (node *node32) print(w io.Writer, pretty bool, buffer string) { 110 var print func(node *node32, depth int) 111 print = func(node *node32, depth int) { 112 for node != nil { 113 for c := 0; c < depth; c++ { 114 fmt.Fprintf(w, " ") 115 } 116 rule := rul3s[node.pegRule] 117 quote := strconv.Quote(string(([]rune(buffer)[node.begin:node.end]))) 118 if !pretty { 119 fmt.Fprintf(w, "%v %v\n", rule, quote) 120 } else { 121 fmt.Fprintf(w, "\x1B[36m%v\x1B[m %v\n", rule, quote) 122 } 123 if node.up != nil { 124 print(node.up, depth+1) 125 } 126 node = node.next 127 } 128 } 129 print(node, 0) 130 } 131 132 func (node *node32) Print(w io.Writer, buffer string) { 133 node.print(w, false, buffer) 134 } 135 136 func (node *node32) PrettyPrint(w io.Writer, buffer string) { 137 node.print(w, true, buffer) 138 } 139 140 type tokens32 struct { 141 tree []token32 142 } 143 144 func (t *tokens32) Trim(length uint32) { 145 t.tree = t.tree[:length] 146 } 147 148 func (t *tokens32) Print() { 149 for _, token := range t.tree { 150 fmt.Println(token.String()) 151 } 152 } 153 154 func (t *tokens32) AST() *node32 { 155 type element struct { 156 node *node32 157 down *element 158 } 159 tokens := t.Tokens() 160 var stack *element 161 for _, token := range tokens { 162 if token.begin == token.end { 163 continue 164 } 165 node := &node32{token32: token} 166 for stack != nil && stack.node.begin >= token.begin && stack.node.end <= token.end { 167 stack.node.next = node.up 168 node.up = stack.node 169 stack = stack.down 170 } 171 stack = &element{node: node, down: stack} 172 } 173 if stack != nil { 174 return stack.node 175 } 176 return nil 177 } 178 179 func (t *tokens32) PrintSyntaxTree(buffer string) { 180 t.AST().Print(os.Stdout, buffer) 181 } 182 183 func (t *tokens32) WriteSyntaxTree(w io.Writer, buffer string) { 184 t.AST().Print(w, buffer) 185 } 186 187 func (t *tokens32) PrettyPrintSyntaxTree(buffer string) { 188 t.AST().PrettyPrint(os.Stdout, buffer) 189 } 190 191 func (t *tokens32) Add(rule pegRule, begin, end, index uint32) { 192 tree, i := t.tree, int(index) 193 if i >= len(tree) { 194 t.tree = append(tree, token32{pegRule: rule, begin: begin, end: end}) 195 return 196 } 197 tree[i] = token32{pegRule: rule, begin: begin, end: end} 198 } 199 200 func (t *tokens32) Tokens() []token32 { 201 return t.tree 202 } 203 204 type JSON struct { 205 Buffer string 206 buffer []rune 207 rules [35]func() bool 208 parse func(rule ...int) error 209 reset func() 210 Pretty bool 211 tokens32 212 } 213 214 func (p *JSON) Parse(rule ...int) error { 215 return p.parse(rule...) 216 } 217 218 func (p *JSON) Reset() { 219 p.reset() 220 } 221 222 type textPosition struct { 223 line, symbol int 224 } 225 226 type textPositionMap map[int]textPosition 227 228 func translatePositions(buffer []rune, positions []int) textPositionMap { 229 length, translations, j, line, symbol := len(positions), make(textPositionMap, len(positions)), 0, 1, 0 230 sort.Ints(positions) 231 232 search: 233 for i, c := range buffer { 234 if c == '\n' { 235 line, symbol = line+1, 0 236 } else { 237 symbol++ 238 } 239 if i == positions[j] { 240 translations[positions[j]] = textPosition{line, symbol} 241 for j++; j < length; j++ { 242 if i != positions[j] { 243 continue search 244 } 245 } 246 break search 247 } 248 } 249 250 return translations 251 } 252 253 type parseError struct { 254 p *JSON 255 max token32 256 } 257 258 func (e *parseError) Error() string { 259 tokens, err := []token32{e.max}, "\n" 260 positions, p := make([]int, 2*len(tokens)), 0 261 for _, token := range tokens { 262 positions[p], p = int(token.begin), p+1 263 positions[p], p = int(token.end), p+1 264 } 265 translations := translatePositions(e.p.buffer, positions) 266 format := "parse error near %v (line %v symbol %v - line %v symbol %v):\n%v\n" 267 if e.p.Pretty { 268 format = "parse error near \x1B[34m%v\x1B[m (line %v symbol %v - line %v symbol %v):\n%v\n" 269 } 270 for _, token := range tokens { 271 begin, end := int(token.begin), int(token.end) 272 err += fmt.Sprintf(format, 273 rul3s[token.pegRule], 274 translations[begin].line, translations[begin].symbol, 275 translations[end].line, translations[end].symbol, 276 strconv.Quote(string(e.p.buffer[begin:end]))) 277 } 278 279 return err 280 } 281 282 func (p *JSON) PrintSyntaxTree() { 283 if p.Pretty { 284 p.tokens32.PrettyPrintSyntaxTree(p.Buffer) 285 } else { 286 p.tokens32.PrintSyntaxTree(p.Buffer) 287 } 288 } 289 290 func (p *JSON) WriteSyntaxTree(w io.Writer) { 291 p.tokens32.WriteSyntaxTree(w, p.Buffer) 292 } 293 294 func (p *JSON) SprintSyntaxTree() string { 295 var bldr strings.Builder 296 p.WriteSyntaxTree(&bldr) 297 return bldr.String() 298 } 299 300 func Pretty(pretty bool) func(*JSON) error { 301 return func(p *JSON) error { 302 p.Pretty = pretty 303 return nil 304 } 305 } 306 307 func Size(size int) func(*JSON) error { 308 return func(p *JSON) error { 309 p.tokens32 = tokens32{tree: make([]token32, 0, size)} 310 return nil 311 } 312 } 313 func (p *JSON) Init(options ...func(*JSON) error) error { 314 var ( 315 max token32 316 position, tokenIndex uint32 317 buffer []rune 318 ) 319 for _, option := range options { 320 err := option(p) 321 if err != nil { 322 return err 323 } 324 } 325 p.reset = func() { 326 max = token32{} 327 position, tokenIndex = 0, 0 328 329 p.buffer = []rune(p.Buffer) 330 if len(p.buffer) == 0 || p.buffer[len(p.buffer)-1] != endSymbol { 331 p.buffer = append(p.buffer, endSymbol) 332 } 333 buffer = p.buffer 334 } 335 p.reset() 336 337 _rules := p.rules 338 tree := p.tokens32 339 p.parse = func(rule ...int) error { 340 r := 1 341 if len(rule) > 0 { 342 r = rule[0] 343 } 344 matches := p.rules[r]() 345 p.tokens32 = tree 346 if matches { 347 p.Trim(tokenIndex) 348 return nil 349 } 350 return &parseError{p, max} 351 } 352 353 add := func(rule pegRule, begin uint32) { 354 tree.Add(rule, begin, position, tokenIndex) 355 tokenIndex++ 356 if begin != position && position > max.end { 357 max = token32{rule, begin, position} 358 } 359 } 360 361 matchDot := func() bool { 362 if buffer[position] != endSymbol { 363 position++ 364 return true 365 } 366 return false 367 } 368 369 /*matchChar := func(c byte) bool { 370 if buffer[position] == c { 371 position++ 372 return true 373 } 374 return false 375 }*/ 376 377 /*matchRange := func(lower byte, upper byte) bool { 378 if c := buffer[position]; c >= lower && c <= upper { 379 position++ 380 return true 381 } 382 return false 383 }*/ 384 385 _rules = [...]func() bool{ 386 nil, 387 /* 0 Document <- <(Spacing JSON EOT)> */ 388 func() bool { 389 position0, tokenIndex0 := position, tokenIndex 390 { 391 position1 := position 392 if !_rules[ruleSpacing]() { 393 goto l0 394 } 395 if !_rules[ruleJSON]() { 396 goto l0 397 } 398 if !_rules[ruleEOT]() { 399 goto l0 400 } 401 add(ruleDocument, position1) 402 } 403 return true 404 l0: 405 position, tokenIndex = position0, tokenIndex0 406 return false 407 }, 408 /* 1 JSON <- <((Object / Array / String / True / False / Null / Number / Import) Spacing)> */ 409 func() bool { 410 position2, tokenIndex2 := position, tokenIndex 411 { 412 position3 := position 413 { 414 position4, tokenIndex4 := position, tokenIndex 415 if !_rules[ruleObject]() { 416 goto l5 417 } 418 goto l4 419 l5: 420 position, tokenIndex = position4, tokenIndex4 421 if !_rules[ruleArray]() { 422 goto l6 423 } 424 goto l4 425 l6: 426 position, tokenIndex = position4, tokenIndex4 427 if !_rules[ruleString]() { 428 goto l7 429 } 430 goto l4 431 l7: 432 position, tokenIndex = position4, tokenIndex4 433 if !_rules[ruleTrue]() { 434 goto l8 435 } 436 goto l4 437 l8: 438 position, tokenIndex = position4, tokenIndex4 439 if !_rules[ruleFalse]() { 440 goto l9 441 } 442 goto l4 443 l9: 444 position, tokenIndex = position4, tokenIndex4 445 if !_rules[ruleNull]() { 446 goto l10 447 } 448 goto l4 449 l10: 450 position, tokenIndex = position4, tokenIndex4 451 if !_rules[ruleNumber]() { 452 goto l11 453 } 454 goto l4 455 l11: 456 position, tokenIndex = position4, tokenIndex4 457 if !_rules[ruleImport]() { 458 goto l2 459 } 460 } 461 l4: 462 if !_rules[ruleSpacing]() { 463 goto l2 464 } 465 add(ruleJSON, position3) 466 } 467 return true 468 l2: 469 position, tokenIndex = position2, tokenIndex2 470 return false 471 }, 472 /* 2 Object <- <(LWING (ObjectKey COLON JSON COMMA)* (ObjectKey COLON JSON)? RWING)> */ 473 func() bool { 474 position12, tokenIndex12 := position, tokenIndex 475 { 476 position13 := position 477 if !_rules[ruleLWING]() { 478 goto l12 479 } 480 l14: 481 { 482 position15, tokenIndex15 := position, tokenIndex 483 if !_rules[ruleObjectKey]() { 484 goto l15 485 } 486 if !_rules[ruleCOLON]() { 487 goto l15 488 } 489 if !_rules[ruleJSON]() { 490 goto l15 491 } 492 if !_rules[ruleCOMMA]() { 493 goto l15 494 } 495 goto l14 496 l15: 497 position, tokenIndex = position15, tokenIndex15 498 } 499 { 500 position16, tokenIndex16 := position, tokenIndex 501 if !_rules[ruleObjectKey]() { 502 goto l16 503 } 504 if !_rules[ruleCOLON]() { 505 goto l16 506 } 507 if !_rules[ruleJSON]() { 508 goto l16 509 } 510 goto l17 511 l16: 512 position, tokenIndex = position16, tokenIndex16 513 } 514 l17: 515 if !_rules[ruleRWING]() { 516 goto l12 517 } 518 add(ruleObject, position13) 519 } 520 return true 521 l12: 522 position, tokenIndex = position12, tokenIndex12 523 return false 524 }, 525 /* 3 ObjectKey <- <(String / SimpleIdentifier)> */ 526 func() bool { 527 position18, tokenIndex18 := position, tokenIndex 528 { 529 position19 := position 530 { 531 position20, tokenIndex20 := position, tokenIndex 532 if !_rules[ruleString]() { 533 goto l21 534 } 535 goto l20 536 l21: 537 position, tokenIndex = position20, tokenIndex20 538 if !_rules[ruleSimpleIdentifier]() { 539 goto l18 540 } 541 } 542 l20: 543 add(ruleObjectKey, position19) 544 } 545 return true 546 l18: 547 position, tokenIndex = position18, tokenIndex18 548 return false 549 }, 550 /* 4 Array <- <(LBRK (JSON COMMA)* JSON? RBRK)> */ 551 func() bool { 552 position22, tokenIndex22 := position, tokenIndex 553 { 554 position23 := position 555 if !_rules[ruleLBRK]() { 556 goto l22 557 } 558 l24: 559 { 560 position25, tokenIndex25 := position, tokenIndex 561 if !_rules[ruleJSON]() { 562 goto l25 563 } 564 if !_rules[ruleCOMMA]() { 565 goto l25 566 } 567 goto l24 568 l25: 569 position, tokenIndex = position25, tokenIndex25 570 } 571 { 572 position26, tokenIndex26 := position, tokenIndex 573 if !_rules[ruleJSON]() { 574 goto l26 575 } 576 goto l27 577 l26: 578 position, tokenIndex = position26, tokenIndex26 579 } 580 l27: 581 if !_rules[ruleRBRK]() { 582 goto l22 583 } 584 add(ruleArray, position23) 585 } 586 return true 587 l22: 588 position, tokenIndex = position22, tokenIndex22 589 return false 590 }, 591 /* 5 Import <- <('@' 'i' 'm' 'p' 'o' 'r' 't' '(' String ')')> */ 592 func() bool { 593 position28, tokenIndex28 := position, tokenIndex 594 { 595 position29 := position 596 if buffer[position] != rune('@') { 597 goto l28 598 } 599 position++ 600 if buffer[position] != rune('i') { 601 goto l28 602 } 603 position++ 604 if buffer[position] != rune('m') { 605 goto l28 606 } 607 position++ 608 if buffer[position] != rune('p') { 609 goto l28 610 } 611 position++ 612 if buffer[position] != rune('o') { 613 goto l28 614 } 615 position++ 616 if buffer[position] != rune('r') { 617 goto l28 618 } 619 position++ 620 if buffer[position] != rune('t') { 621 goto l28 622 } 623 position++ 624 if buffer[position] != rune('(') { 625 goto l28 626 } 627 position++ 628 if !_rules[ruleString]() { 629 goto l28 630 } 631 if buffer[position] != rune(')') { 632 goto l28 633 } 634 position++ 635 add(ruleImport, position29) 636 } 637 return true 638 l28: 639 position, tokenIndex = position28, tokenIndex28 640 return false 641 }, 642 /* 6 SimpleIdentifier <- <([0-9] / [A-Z] / [a-z] / '_' / '$')+> */ 643 func() bool { 644 position30, tokenIndex30 := position, tokenIndex 645 { 646 position31 := position 647 { 648 position34, tokenIndex34 := position, tokenIndex 649 if c := buffer[position]; c < rune('0') || c > rune('9') { 650 goto l35 651 } 652 position++ 653 goto l34 654 l35: 655 position, tokenIndex = position34, tokenIndex34 656 if c := buffer[position]; c < rune('A') || c > rune('Z') { 657 goto l36 658 } 659 position++ 660 goto l34 661 l36: 662 position, tokenIndex = position34, tokenIndex34 663 if c := buffer[position]; c < rune('a') || c > rune('z') { 664 goto l37 665 } 666 position++ 667 goto l34 668 l37: 669 position, tokenIndex = position34, tokenIndex34 670 if buffer[position] != rune('_') { 671 goto l38 672 } 673 position++ 674 goto l34 675 l38: 676 position, tokenIndex = position34, tokenIndex34 677 if buffer[position] != rune('$') { 678 goto l30 679 } 680 position++ 681 } 682 l34: 683 l32: 684 { 685 position33, tokenIndex33 := position, tokenIndex 686 { 687 position39, tokenIndex39 := position, tokenIndex 688 if c := buffer[position]; c < rune('0') || c > rune('9') { 689 goto l40 690 } 691 position++ 692 goto l39 693 l40: 694 position, tokenIndex = position39, tokenIndex39 695 if c := buffer[position]; c < rune('A') || c > rune('Z') { 696 goto l41 697 } 698 position++ 699 goto l39 700 l41: 701 position, tokenIndex = position39, tokenIndex39 702 if c := buffer[position]; c < rune('a') || c > rune('z') { 703 goto l42 704 } 705 position++ 706 goto l39 707 l42: 708 position, tokenIndex = position39, tokenIndex39 709 if buffer[position] != rune('_') { 710 goto l43 711 } 712 position++ 713 goto l39 714 l43: 715 position, tokenIndex = position39, tokenIndex39 716 if buffer[position] != rune('$') { 717 goto l33 718 } 719 position++ 720 } 721 l39: 722 goto l32 723 l33: 724 position, tokenIndex = position33, tokenIndex33 725 } 726 add(ruleSimpleIdentifier, position31) 727 } 728 return true 729 l30: 730 position, tokenIndex = position30, tokenIndex30 731 return false 732 }, 733 /* 7 String <- <(SingleQuoteLiteral / DoubleQuoteLiteral)> */ 734 func() bool { 735 position44, tokenIndex44 := position, tokenIndex 736 { 737 position45 := position 738 { 739 position46, tokenIndex46 := position, tokenIndex 740 if !_rules[ruleSingleQuoteLiteral]() { 741 goto l47 742 } 743 goto l46 744 l47: 745 position, tokenIndex = position46, tokenIndex46 746 if !_rules[ruleDoubleQuoteLiteral]() { 747 goto l44 748 } 749 } 750 l46: 751 add(ruleString, position45) 752 } 753 return true 754 l44: 755 position, tokenIndex = position44, tokenIndex44 756 return false 757 }, 758 /* 8 SingleQuoteLiteral <- <('\'' (SingleQuoteEscape / (!('\'' / '\\' / '\n' / '\r') .))* '\'')> */ 759 func() bool { 760 position48, tokenIndex48 := position, tokenIndex 761 { 762 position49 := position 763 if buffer[position] != rune('\'') { 764 goto l48 765 } 766 position++ 767 l50: 768 { 769 position51, tokenIndex51 := position, tokenIndex 770 { 771 position52, tokenIndex52 := position, tokenIndex 772 if !_rules[ruleSingleQuoteEscape]() { 773 goto l53 774 } 775 goto l52 776 l53: 777 position, tokenIndex = position52, tokenIndex52 778 { 779 position54, tokenIndex54 := position, tokenIndex 780 { 781 position55, tokenIndex55 := position, tokenIndex 782 if buffer[position] != rune('\'') { 783 goto l56 784 } 785 position++ 786 goto l55 787 l56: 788 position, tokenIndex = position55, tokenIndex55 789 if buffer[position] != rune('\\') { 790 goto l57 791 } 792 position++ 793 goto l55 794 l57: 795 position, tokenIndex = position55, tokenIndex55 796 if buffer[position] != rune('\n') { 797 goto l58 798 } 799 position++ 800 goto l55 801 l58: 802 position, tokenIndex = position55, tokenIndex55 803 if buffer[position] != rune('\r') { 804 goto l54 805 } 806 position++ 807 } 808 l55: 809 goto l51 810 l54: 811 position, tokenIndex = position54, tokenIndex54 812 } 813 if !matchDot() { 814 goto l51 815 } 816 } 817 l52: 818 goto l50 819 l51: 820 position, tokenIndex = position51, tokenIndex51 821 } 822 if buffer[position] != rune('\'') { 823 goto l48 824 } 825 position++ 826 add(ruleSingleQuoteLiteral, position49) 827 } 828 return true 829 l48: 830 position, tokenIndex = position48, tokenIndex48 831 return false 832 }, 833 /* 9 DoubleQuoteLiteral <- <('"' (DoubleQuoteEscape / (!('"' / '\\' / '\n' / '\r') .))* '"')> */ 834 func() bool { 835 position59, tokenIndex59 := position, tokenIndex 836 { 837 position60 := position 838 if buffer[position] != rune('"') { 839 goto l59 840 } 841 position++ 842 l61: 843 { 844 position62, tokenIndex62 := position, tokenIndex 845 { 846 position63, tokenIndex63 := position, tokenIndex 847 if !_rules[ruleDoubleQuoteEscape]() { 848 goto l64 849 } 850 goto l63 851 l64: 852 position, tokenIndex = position63, tokenIndex63 853 { 854 position65, tokenIndex65 := position, tokenIndex 855 { 856 position66, tokenIndex66 := position, tokenIndex 857 if buffer[position] != rune('"') { 858 goto l67 859 } 860 position++ 861 goto l66 862 l67: 863 position, tokenIndex = position66, tokenIndex66 864 if buffer[position] != rune('\\') { 865 goto l68 866 } 867 position++ 868 goto l66 869 l68: 870 position, tokenIndex = position66, tokenIndex66 871 if buffer[position] != rune('\n') { 872 goto l69 873 } 874 position++ 875 goto l66 876 l69: 877 position, tokenIndex = position66, tokenIndex66 878 if buffer[position] != rune('\r') { 879 goto l65 880 } 881 position++ 882 } 883 l66: 884 goto l62 885 l65: 886 position, tokenIndex = position65, tokenIndex65 887 } 888 if !matchDot() { 889 goto l62 890 } 891 } 892 l63: 893 goto l61 894 l62: 895 position, tokenIndex = position62, tokenIndex62 896 } 897 if buffer[position] != rune('"') { 898 goto l59 899 } 900 position++ 901 add(ruleDoubleQuoteLiteral, position60) 902 } 903 return true 904 l59: 905 position, tokenIndex = position59, tokenIndex59 906 return false 907 }, 908 /* 10 SingleQuoteEscape <- <('\\' ('b' / 't' / 'n' / 'f' / 'r' / '\'' / '\\' / '/' / UnicodeEscape))> */ 909 func() bool { 910 position70, tokenIndex70 := position, tokenIndex 911 { 912 position71 := position 913 if buffer[position] != rune('\\') { 914 goto l70 915 } 916 position++ 917 { 918 position72, tokenIndex72 := position, tokenIndex 919 if buffer[position] != rune('b') { 920 goto l73 921 } 922 position++ 923 goto l72 924 l73: 925 position, tokenIndex = position72, tokenIndex72 926 if buffer[position] != rune('t') { 927 goto l74 928 } 929 position++ 930 goto l72 931 l74: 932 position, tokenIndex = position72, tokenIndex72 933 if buffer[position] != rune('n') { 934 goto l75 935 } 936 position++ 937 goto l72 938 l75: 939 position, tokenIndex = position72, tokenIndex72 940 if buffer[position] != rune('f') { 941 goto l76 942 } 943 position++ 944 goto l72 945 l76: 946 position, tokenIndex = position72, tokenIndex72 947 if buffer[position] != rune('r') { 948 goto l77 949 } 950 position++ 951 goto l72 952 l77: 953 position, tokenIndex = position72, tokenIndex72 954 if buffer[position] != rune('\'') { 955 goto l78 956 } 957 position++ 958 goto l72 959 l78: 960 position, tokenIndex = position72, tokenIndex72 961 if buffer[position] != rune('\\') { 962 goto l79 963 } 964 position++ 965 goto l72 966 l79: 967 position, tokenIndex = position72, tokenIndex72 968 if buffer[position] != rune('/') { 969 goto l80 970 } 971 position++ 972 goto l72 973 l80: 974 position, tokenIndex = position72, tokenIndex72 975 if !_rules[ruleUnicodeEscape]() { 976 goto l70 977 } 978 } 979 l72: 980 add(ruleSingleQuoteEscape, position71) 981 } 982 return true 983 l70: 984 position, tokenIndex = position70, tokenIndex70 985 return false 986 }, 987 /* 11 DoubleQuoteEscape <- <('\\' ('b' / 't' / 'n' / 'f' / 'r' / '"' / '\\' / '/' / UnicodeEscape))> */ 988 func() bool { 989 position81, tokenIndex81 := position, tokenIndex 990 { 991 position82 := position 992 if buffer[position] != rune('\\') { 993 goto l81 994 } 995 position++ 996 { 997 position83, tokenIndex83 := position, tokenIndex 998 if buffer[position] != rune('b') { 999 goto l84 1000 } 1001 position++ 1002 goto l83 1003 l84: 1004 position, tokenIndex = position83, tokenIndex83 1005 if buffer[position] != rune('t') { 1006 goto l85 1007 } 1008 position++ 1009 goto l83 1010 l85: 1011 position, tokenIndex = position83, tokenIndex83 1012 if buffer[position] != rune('n') { 1013 goto l86 1014 } 1015 position++ 1016 goto l83 1017 l86: 1018 position, tokenIndex = position83, tokenIndex83 1019 if buffer[position] != rune('f') { 1020 goto l87 1021 } 1022 position++ 1023 goto l83 1024 l87: 1025 position, tokenIndex = position83, tokenIndex83 1026 if buffer[position] != rune('r') { 1027 goto l88 1028 } 1029 position++ 1030 goto l83 1031 l88: 1032 position, tokenIndex = position83, tokenIndex83 1033 if buffer[position] != rune('"') { 1034 goto l89 1035 } 1036 position++ 1037 goto l83 1038 l89: 1039 position, tokenIndex = position83, tokenIndex83 1040 if buffer[position] != rune('\\') { 1041 goto l90 1042 } 1043 position++ 1044 goto l83 1045 l90: 1046 position, tokenIndex = position83, tokenIndex83 1047 if buffer[position] != rune('/') { 1048 goto l91 1049 } 1050 position++ 1051 goto l83 1052 l91: 1053 position, tokenIndex = position83, tokenIndex83 1054 if !_rules[ruleUnicodeEscape]() { 1055 goto l81 1056 } 1057 } 1058 l83: 1059 add(ruleDoubleQuoteEscape, position82) 1060 } 1061 return true 1062 l81: 1063 position, tokenIndex = position81, tokenIndex81 1064 return false 1065 }, 1066 /* 12 UnicodeEscape <- <('u' HexDigit HexDigit HexDigit HexDigit)> */ 1067 func() bool { 1068 position92, tokenIndex92 := position, tokenIndex 1069 { 1070 position93 := position 1071 if buffer[position] != rune('u') { 1072 goto l92 1073 } 1074 position++ 1075 if !_rules[ruleHexDigit]() { 1076 goto l92 1077 } 1078 if !_rules[ruleHexDigit]() { 1079 goto l92 1080 } 1081 if !_rules[ruleHexDigit]() { 1082 goto l92 1083 } 1084 if !_rules[ruleHexDigit]() { 1085 goto l92 1086 } 1087 add(ruleUnicodeEscape, position93) 1088 } 1089 return true 1090 l92: 1091 position, tokenIndex = position92, tokenIndex92 1092 return false 1093 }, 1094 /* 13 HexDigit <- <([a-f] / [A-F] / [0-9])> */ 1095 func() bool { 1096 position94, tokenIndex94 := position, tokenIndex 1097 { 1098 position95 := position 1099 { 1100 position96, tokenIndex96 := position, tokenIndex 1101 if c := buffer[position]; c < rune('a') || c > rune('f') { 1102 goto l97 1103 } 1104 position++ 1105 goto l96 1106 l97: 1107 position, tokenIndex = position96, tokenIndex96 1108 if c := buffer[position]; c < rune('A') || c > rune('F') { 1109 goto l98 1110 } 1111 position++ 1112 goto l96 1113 l98: 1114 position, tokenIndex = position96, tokenIndex96 1115 if c := buffer[position]; c < rune('0') || c > rune('9') { 1116 goto l94 1117 } 1118 position++ 1119 } 1120 l96: 1121 add(ruleHexDigit, position95) 1122 } 1123 return true 1124 l94: 1125 position, tokenIndex = position94, tokenIndex94 1126 return false 1127 }, 1128 /* 14 True <- <(('t' 'r' 'u' 'e') / ('T' 'r' 'u' 'e'))> */ 1129 func() bool { 1130 position99, tokenIndex99 := position, tokenIndex 1131 { 1132 position100 := position 1133 { 1134 position101, tokenIndex101 := position, tokenIndex 1135 if buffer[position] != rune('t') { 1136 goto l102 1137 } 1138 position++ 1139 if buffer[position] != rune('r') { 1140 goto l102 1141 } 1142 position++ 1143 if buffer[position] != rune('u') { 1144 goto l102 1145 } 1146 position++ 1147 if buffer[position] != rune('e') { 1148 goto l102 1149 } 1150 position++ 1151 goto l101 1152 l102: 1153 position, tokenIndex = position101, tokenIndex101 1154 if buffer[position] != rune('T') { 1155 goto l99 1156 } 1157 position++ 1158 if buffer[position] != rune('r') { 1159 goto l99 1160 } 1161 position++ 1162 if buffer[position] != rune('u') { 1163 goto l99 1164 } 1165 position++ 1166 if buffer[position] != rune('e') { 1167 goto l99 1168 } 1169 position++ 1170 } 1171 l101: 1172 add(ruleTrue, position100) 1173 } 1174 return true 1175 l99: 1176 position, tokenIndex = position99, tokenIndex99 1177 return false 1178 }, 1179 /* 15 False <- <(('f' 'a' 'l' 's' 'e') / ('F' 'a' 'l' 's' 'e'))> */ 1180 func() bool { 1181 position103, tokenIndex103 := position, tokenIndex 1182 { 1183 position104 := position 1184 { 1185 position105, tokenIndex105 := position, tokenIndex 1186 if buffer[position] != rune('f') { 1187 goto l106 1188 } 1189 position++ 1190 if buffer[position] != rune('a') { 1191 goto l106 1192 } 1193 position++ 1194 if buffer[position] != rune('l') { 1195 goto l106 1196 } 1197 position++ 1198 if buffer[position] != rune('s') { 1199 goto l106 1200 } 1201 position++ 1202 if buffer[position] != rune('e') { 1203 goto l106 1204 } 1205 position++ 1206 goto l105 1207 l106: 1208 position, tokenIndex = position105, tokenIndex105 1209 if buffer[position] != rune('F') { 1210 goto l103 1211 } 1212 position++ 1213 if buffer[position] != rune('a') { 1214 goto l103 1215 } 1216 position++ 1217 if buffer[position] != rune('l') { 1218 goto l103 1219 } 1220 position++ 1221 if buffer[position] != rune('s') { 1222 goto l103 1223 } 1224 position++ 1225 if buffer[position] != rune('e') { 1226 goto l103 1227 } 1228 position++ 1229 } 1230 l105: 1231 add(ruleFalse, position104) 1232 } 1233 return true 1234 l103: 1235 position, tokenIndex = position103, tokenIndex103 1236 return false 1237 }, 1238 /* 16 Null <- <(('n' 'u' 'l' 'l') / ('N' 'o' 'n' 'e'))> */ 1239 func() bool { 1240 position107, tokenIndex107 := position, tokenIndex 1241 { 1242 position108 := position 1243 { 1244 position109, tokenIndex109 := position, tokenIndex 1245 if buffer[position] != rune('n') { 1246 goto l110 1247 } 1248 position++ 1249 if buffer[position] != rune('u') { 1250 goto l110 1251 } 1252 position++ 1253 if buffer[position] != rune('l') { 1254 goto l110 1255 } 1256 position++ 1257 if buffer[position] != rune('l') { 1258 goto l110 1259 } 1260 position++ 1261 goto l109 1262 l110: 1263 position, tokenIndex = position109, tokenIndex109 1264 if buffer[position] != rune('N') { 1265 goto l107 1266 } 1267 position++ 1268 if buffer[position] != rune('o') { 1269 goto l107 1270 } 1271 position++ 1272 if buffer[position] != rune('n') { 1273 goto l107 1274 } 1275 position++ 1276 if buffer[position] != rune('e') { 1277 goto l107 1278 } 1279 position++ 1280 } 1281 l109: 1282 add(ruleNull, position108) 1283 } 1284 return true 1285 l107: 1286 position, tokenIndex = position107, tokenIndex107 1287 return false 1288 }, 1289 /* 17 Number <- <(Minus? IntegralPart FractionalPart? ExponentPart?)> */ 1290 func() bool { 1291 position111, tokenIndex111 := position, tokenIndex 1292 { 1293 position112 := position 1294 { 1295 position113, tokenIndex113 := position, tokenIndex 1296 if !_rules[ruleMinus]() { 1297 goto l113 1298 } 1299 goto l114 1300 l113: 1301 position, tokenIndex = position113, tokenIndex113 1302 } 1303 l114: 1304 if !_rules[ruleIntegralPart]() { 1305 goto l111 1306 } 1307 { 1308 position115, tokenIndex115 := position, tokenIndex 1309 if !_rules[ruleFractionalPart]() { 1310 goto l115 1311 } 1312 goto l116 1313 l115: 1314 position, tokenIndex = position115, tokenIndex115 1315 } 1316 l116: 1317 { 1318 position117, tokenIndex117 := position, tokenIndex 1319 if !_rules[ruleExponentPart]() { 1320 goto l117 1321 } 1322 goto l118 1323 l117: 1324 position, tokenIndex = position117, tokenIndex117 1325 } 1326 l118: 1327 add(ruleNumber, position112) 1328 } 1329 return true 1330 l111: 1331 position, tokenIndex = position111, tokenIndex111 1332 return false 1333 }, 1334 /* 18 Minus <- <'-'> */ 1335 func() bool { 1336 position119, tokenIndex119 := position, tokenIndex 1337 { 1338 position120 := position 1339 if buffer[position] != rune('-') { 1340 goto l119 1341 } 1342 position++ 1343 add(ruleMinus, position120) 1344 } 1345 return true 1346 l119: 1347 position, tokenIndex = position119, tokenIndex119 1348 return false 1349 }, 1350 /* 19 IntegralPart <- <('0' / ([1-9] [0-9]*))> */ 1351 func() bool { 1352 position121, tokenIndex121 := position, tokenIndex 1353 { 1354 position122 := position 1355 { 1356 position123, tokenIndex123 := position, tokenIndex 1357 if buffer[position] != rune('0') { 1358 goto l124 1359 } 1360 position++ 1361 goto l123 1362 l124: 1363 position, tokenIndex = position123, tokenIndex123 1364 if c := buffer[position]; c < rune('1') || c > rune('9') { 1365 goto l121 1366 } 1367 position++ 1368 l125: 1369 { 1370 position126, tokenIndex126 := position, tokenIndex 1371 if c := buffer[position]; c < rune('0') || c > rune('9') { 1372 goto l126 1373 } 1374 position++ 1375 goto l125 1376 l126: 1377 position, tokenIndex = position126, tokenIndex126 1378 } 1379 } 1380 l123: 1381 add(ruleIntegralPart, position122) 1382 } 1383 return true 1384 l121: 1385 position, tokenIndex = position121, tokenIndex121 1386 return false 1387 }, 1388 /* 20 FractionalPart <- <('.' [0-9]+)> */ 1389 func() bool { 1390 position127, tokenIndex127 := position, tokenIndex 1391 { 1392 position128 := position 1393 if buffer[position] != rune('.') { 1394 goto l127 1395 } 1396 position++ 1397 if c := buffer[position]; c < rune('0') || c > rune('9') { 1398 goto l127 1399 } 1400 position++ 1401 l129: 1402 { 1403 position130, tokenIndex130 := position, tokenIndex 1404 if c := buffer[position]; c < rune('0') || c > rune('9') { 1405 goto l130 1406 } 1407 position++ 1408 goto l129 1409 l130: 1410 position, tokenIndex = position130, tokenIndex130 1411 } 1412 add(ruleFractionalPart, position128) 1413 } 1414 return true 1415 l127: 1416 position, tokenIndex = position127, tokenIndex127 1417 return false 1418 }, 1419 /* 21 ExponentPart <- <(('e' / 'E') ('+' / '-')? [0-9]+)> */ 1420 func() bool { 1421 position131, tokenIndex131 := position, tokenIndex 1422 { 1423 position132 := position 1424 { 1425 position133, tokenIndex133 := position, tokenIndex 1426 if buffer[position] != rune('e') { 1427 goto l134 1428 } 1429 position++ 1430 goto l133 1431 l134: 1432 position, tokenIndex = position133, tokenIndex133 1433 if buffer[position] != rune('E') { 1434 goto l131 1435 } 1436 position++ 1437 } 1438 l133: 1439 { 1440 position135, tokenIndex135 := position, tokenIndex 1441 { 1442 position137, tokenIndex137 := position, tokenIndex 1443 if buffer[position] != rune('+') { 1444 goto l138 1445 } 1446 position++ 1447 goto l137 1448 l138: 1449 position, tokenIndex = position137, tokenIndex137 1450 if buffer[position] != rune('-') { 1451 goto l135 1452 } 1453 position++ 1454 } 1455 l137: 1456 goto l136 1457 l135: 1458 position, tokenIndex = position135, tokenIndex135 1459 } 1460 l136: 1461 if c := buffer[position]; c < rune('0') || c > rune('9') { 1462 goto l131 1463 } 1464 position++ 1465 l139: 1466 { 1467 position140, tokenIndex140 := position, tokenIndex 1468 if c := buffer[position]; c < rune('0') || c > rune('9') { 1469 goto l140 1470 } 1471 position++ 1472 goto l139 1473 l140: 1474 position, tokenIndex = position140, tokenIndex140 1475 } 1476 add(ruleExponentPart, position132) 1477 } 1478 return true 1479 l131: 1480 position, tokenIndex = position131, tokenIndex131 1481 return false 1482 }, 1483 /* 22 Spacing <- <(Whitespace / LongComment / LineComment / Pragma)*> */ 1484 func() bool { 1485 { 1486 position142 := position 1487 l143: 1488 { 1489 position144, tokenIndex144 := position, tokenIndex 1490 { 1491 position145, tokenIndex145 := position, tokenIndex 1492 if !_rules[ruleWhitespace]() { 1493 goto l146 1494 } 1495 goto l145 1496 l146: 1497 position, tokenIndex = position145, tokenIndex145 1498 if !_rules[ruleLongComment]() { 1499 goto l147 1500 } 1501 goto l145 1502 l147: 1503 position, tokenIndex = position145, tokenIndex145 1504 if !_rules[ruleLineComment]() { 1505 goto l148 1506 } 1507 goto l145 1508 l148: 1509 position, tokenIndex = position145, tokenIndex145 1510 if !_rules[rulePragma]() { 1511 goto l144 1512 } 1513 } 1514 l145: 1515 goto l143 1516 l144: 1517 position, tokenIndex = position144, tokenIndex144 1518 } 1519 add(ruleSpacing, position142) 1520 } 1521 return true 1522 }, 1523 /* 23 Whitespace <- <(' ' / '\t' / '\r' / '\n')+> */ 1524 func() bool { 1525 position149, tokenIndex149 := position, tokenIndex 1526 { 1527 position150 := position 1528 { 1529 position153, tokenIndex153 := position, tokenIndex 1530 if buffer[position] != rune(' ') { 1531 goto l154 1532 } 1533 position++ 1534 goto l153 1535 l154: 1536 position, tokenIndex = position153, tokenIndex153 1537 if buffer[position] != rune('\t') { 1538 goto l155 1539 } 1540 position++ 1541 goto l153 1542 l155: 1543 position, tokenIndex = position153, tokenIndex153 1544 if buffer[position] != rune('\r') { 1545 goto l156 1546 } 1547 position++ 1548 goto l153 1549 l156: 1550 position, tokenIndex = position153, tokenIndex153 1551 if buffer[position] != rune('\n') { 1552 goto l149 1553 } 1554 position++ 1555 } 1556 l153: 1557 l151: 1558 { 1559 position152, tokenIndex152 := position, tokenIndex 1560 { 1561 position157, tokenIndex157 := position, tokenIndex 1562 if buffer[position] != rune(' ') { 1563 goto l158 1564 } 1565 position++ 1566 goto l157 1567 l158: 1568 position, tokenIndex = position157, tokenIndex157 1569 if buffer[position] != rune('\t') { 1570 goto l159 1571 } 1572 position++ 1573 goto l157 1574 l159: 1575 position, tokenIndex = position157, tokenIndex157 1576 if buffer[position] != rune('\r') { 1577 goto l160 1578 } 1579 position++ 1580 goto l157 1581 l160: 1582 position, tokenIndex = position157, tokenIndex157 1583 if buffer[position] != rune('\n') { 1584 goto l152 1585 } 1586 position++ 1587 } 1588 l157: 1589 goto l151 1590 l152: 1591 position, tokenIndex = position152, tokenIndex152 1592 } 1593 add(ruleWhitespace, position150) 1594 } 1595 return true 1596 l149: 1597 position, tokenIndex = position149, tokenIndex149 1598 return false 1599 }, 1600 /* 24 LongComment <- <('/' '*' (!('*' '/') .)* ('*' '/'))> */ 1601 func() bool { 1602 position161, tokenIndex161 := position, tokenIndex 1603 { 1604 position162 := position 1605 if buffer[position] != rune('/') { 1606 goto l161 1607 } 1608 position++ 1609 if buffer[position] != rune('*') { 1610 goto l161 1611 } 1612 position++ 1613 l163: 1614 { 1615 position164, tokenIndex164 := position, tokenIndex 1616 { 1617 position165, tokenIndex165 := position, tokenIndex 1618 if buffer[position] != rune('*') { 1619 goto l165 1620 } 1621 position++ 1622 if buffer[position] != rune('/') { 1623 goto l165 1624 } 1625 position++ 1626 goto l164 1627 l165: 1628 position, tokenIndex = position165, tokenIndex165 1629 } 1630 if !matchDot() { 1631 goto l164 1632 } 1633 goto l163 1634 l164: 1635 position, tokenIndex = position164, tokenIndex164 1636 } 1637 if buffer[position] != rune('*') { 1638 goto l161 1639 } 1640 position++ 1641 if buffer[position] != rune('/') { 1642 goto l161 1643 } 1644 position++ 1645 add(ruleLongComment, position162) 1646 } 1647 return true 1648 l161: 1649 position, tokenIndex = position161, tokenIndex161 1650 return false 1651 }, 1652 /* 25 LineComment <- <('/' '/' (!('\r' / '\n') .)* ('\r' / '\n'))> */ 1653 func() bool { 1654 position166, tokenIndex166 := position, tokenIndex 1655 { 1656 position167 := position 1657 if buffer[position] != rune('/') { 1658 goto l166 1659 } 1660 position++ 1661 if buffer[position] != rune('/') { 1662 goto l166 1663 } 1664 position++ 1665 l168: 1666 { 1667 position169, tokenIndex169 := position, tokenIndex 1668 { 1669 position170, tokenIndex170 := position, tokenIndex 1670 { 1671 position171, tokenIndex171 := position, tokenIndex 1672 if buffer[position] != rune('\r') { 1673 goto l172 1674 } 1675 position++ 1676 goto l171 1677 l172: 1678 position, tokenIndex = position171, tokenIndex171 1679 if buffer[position] != rune('\n') { 1680 goto l170 1681 } 1682 position++ 1683 } 1684 l171: 1685 goto l169 1686 l170: 1687 position, tokenIndex = position170, tokenIndex170 1688 } 1689 if !matchDot() { 1690 goto l169 1691 } 1692 goto l168 1693 l169: 1694 position, tokenIndex = position169, tokenIndex169 1695 } 1696 { 1697 position173, tokenIndex173 := position, tokenIndex 1698 if buffer[position] != rune('\r') { 1699 goto l174 1700 } 1701 position++ 1702 goto l173 1703 l174: 1704 position, tokenIndex = position173, tokenIndex173 1705 if buffer[position] != rune('\n') { 1706 goto l166 1707 } 1708 position++ 1709 } 1710 l173: 1711 add(ruleLineComment, position167) 1712 } 1713 return true 1714 l166: 1715 position, tokenIndex = position166, tokenIndex166 1716 return false 1717 }, 1718 /* 26 Pragma <- <('#' (!('\r' / '\n') .)* ('\r' / '\n'))> */ 1719 func() bool { 1720 position175, tokenIndex175 := position, tokenIndex 1721 { 1722 position176 := position 1723 if buffer[position] != rune('#') { 1724 goto l175 1725 } 1726 position++ 1727 l177: 1728 { 1729 position178, tokenIndex178 := position, tokenIndex 1730 { 1731 position179, tokenIndex179 := position, tokenIndex 1732 { 1733 position180, tokenIndex180 := position, tokenIndex 1734 if buffer[position] != rune('\r') { 1735 goto l181 1736 } 1737 position++ 1738 goto l180 1739 l181: 1740 position, tokenIndex = position180, tokenIndex180 1741 if buffer[position] != rune('\n') { 1742 goto l179 1743 } 1744 position++ 1745 } 1746 l180: 1747 goto l178 1748 l179: 1749 position, tokenIndex = position179, tokenIndex179 1750 } 1751 if !matchDot() { 1752 goto l178 1753 } 1754 goto l177 1755 l178: 1756 position, tokenIndex = position178, tokenIndex178 1757 } 1758 { 1759 position182, tokenIndex182 := position, tokenIndex 1760 if buffer[position] != rune('\r') { 1761 goto l183 1762 } 1763 position++ 1764 goto l182 1765 l183: 1766 position, tokenIndex = position182, tokenIndex182 1767 if buffer[position] != rune('\n') { 1768 goto l175 1769 } 1770 position++ 1771 } 1772 l182: 1773 add(rulePragma, position176) 1774 } 1775 return true 1776 l175: 1777 position, tokenIndex = position175, tokenIndex175 1778 return false 1779 }, 1780 /* 27 LWING <- <('{' Spacing)> */ 1781 func() bool { 1782 position184, tokenIndex184 := position, tokenIndex 1783 { 1784 position185 := position 1785 if buffer[position] != rune('{') { 1786 goto l184 1787 } 1788 position++ 1789 if !_rules[ruleSpacing]() { 1790 goto l184 1791 } 1792 add(ruleLWING, position185) 1793 } 1794 return true 1795 l184: 1796 position, tokenIndex = position184, tokenIndex184 1797 return false 1798 }, 1799 /* 28 RWING <- <('}' Spacing)> */ 1800 func() bool { 1801 position186, tokenIndex186 := position, tokenIndex 1802 { 1803 position187 := position 1804 if buffer[position] != rune('}') { 1805 goto l186 1806 } 1807 position++ 1808 if !_rules[ruleSpacing]() { 1809 goto l186 1810 } 1811 add(ruleRWING, position187) 1812 } 1813 return true 1814 l186: 1815 position, tokenIndex = position186, tokenIndex186 1816 return false 1817 }, 1818 /* 29 LBRK <- <('[' Spacing)> */ 1819 func() bool { 1820 position188, tokenIndex188 := position, tokenIndex 1821 { 1822 position189 := position 1823 if buffer[position] != rune('[') { 1824 goto l188 1825 } 1826 position++ 1827 if !_rules[ruleSpacing]() { 1828 goto l188 1829 } 1830 add(ruleLBRK, position189) 1831 } 1832 return true 1833 l188: 1834 position, tokenIndex = position188, tokenIndex188 1835 return false 1836 }, 1837 /* 30 RBRK <- <(']' Spacing)> */ 1838 func() bool { 1839 position190, tokenIndex190 := position, tokenIndex 1840 { 1841 position191 := position 1842 if buffer[position] != rune(']') { 1843 goto l190 1844 } 1845 position++ 1846 if !_rules[ruleSpacing]() { 1847 goto l190 1848 } 1849 add(ruleRBRK, position191) 1850 } 1851 return true 1852 l190: 1853 position, tokenIndex = position190, tokenIndex190 1854 return false 1855 }, 1856 /* 31 COMMA <- <(',' Spacing)> */ 1857 func() bool { 1858 position192, tokenIndex192 := position, tokenIndex 1859 { 1860 position193 := position 1861 if buffer[position] != rune(',') { 1862 goto l192 1863 } 1864 position++ 1865 if !_rules[ruleSpacing]() { 1866 goto l192 1867 } 1868 add(ruleCOMMA, position193) 1869 } 1870 return true 1871 l192: 1872 position, tokenIndex = position192, tokenIndex192 1873 return false 1874 }, 1875 /* 32 COLON <- <(':' Spacing)> */ 1876 func() bool { 1877 position194, tokenIndex194 := position, tokenIndex 1878 { 1879 position195 := position 1880 if buffer[position] != rune(':') { 1881 goto l194 1882 } 1883 position++ 1884 if !_rules[ruleSpacing]() { 1885 goto l194 1886 } 1887 add(ruleCOLON, position195) 1888 } 1889 return true 1890 l194: 1891 position, tokenIndex = position194, tokenIndex194 1892 return false 1893 }, 1894 /* 33 EOT <- <!.> */ 1895 func() bool { 1896 position196, tokenIndex196 := position, tokenIndex 1897 { 1898 position197 := position 1899 { 1900 position198, tokenIndex198 := position, tokenIndex 1901 if !matchDot() { 1902 goto l198 1903 } 1904 goto l196 1905 l198: 1906 position, tokenIndex = position198, tokenIndex198 1907 } 1908 add(ruleEOT, position197) 1909 } 1910 return true 1911 l196: 1912 position, tokenIndex = position196, tokenIndex196 1913 return false 1914 }, 1915 } 1916 p.rules = _rules 1917 return nil 1918 }