robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
a5e5ec8910
master
1local REMOVE_THIS =vim . NIL 2 3return function ( itp , _check_parsing , hl , fmtn ) 4local function check_parsing ( ... ) 5return _check_parsing ( { flags ={ 0 , 1 , 2 , 3 } , funcname ='check_parsing' } , ... ) 6end 7local function check_asgn_parsing ( ... ) 8return _check_parsing ( { 9flags ={ 4 , 5 , 6 , 7 } , 10funcname ='check_asgn_parsing' , 11} , ... ) 12end 13itp ( 'works with + and @a' , function () 14check_parsing ( '@a' , { 15ast ={ 16'Register(name=a):0:0:@a' , 17} , 18} , { 19hl ( 'Register' , '@a' ), 20} ) 21check_parsing ( '+@a' , { 22ast ={ 23{ 24'UnaryPlus:0:0:+' , 25children ={ 26'Register(name=a):0:1:@a' , 27} , 28} , 29} , 30} , { 31hl ( 'UnaryPlus' , '+' ), 32hl ( 'Register' , '@a' ), 33} ) 34check_parsing ( '@a+@b' , { 35ast ={ 36{ 37'BinaryPlus:0:2:+' , 38children ={ 39'Register(name=a):0:0:@a' , 40'Register(name=b):0:3:@b' , 41} , 42} , 43} , 44} , { 45hl ( 'Register' , '@a' ), 46hl ( 'BinaryPlus' , '+' ), 47hl ( 'Register' , '@b' ), 48} ) 49check_parsing ( '@a+@b+@c' , { 50ast ={ 51{ 52'BinaryPlus:0:5:+' , 53children ={ 54{ 55'BinaryPlus:0:2:+' , 56children ={ 57'Register(name=a):0:0:@a' , 58'Register(name=b):0:3:@b' , 59} , 60} , 61'Register(name=c):0:6:@c' , 62} , 63} , 64} , 65} , { 66hl ( 'Register' , '@a' ), 67hl ( 'BinaryPlus' , '+' ), 68hl ( 'Register' , '@b' ), 69hl ( 'BinaryPlus' , '+' ), 70hl ( 'Register' , '@c' ), 71} ) 72check_parsing ( '+@a+@b' , { 73ast ={ 74{ 75'BinaryPlus:0:3:+' , 76children ={ 77{ 78'UnaryPlus:0:0:+' , 79children ={ 80'Register(name=a):0:1:@a' , 81} , 82} , 83'Register(name=b):0:4:@b' , 84} , 85} , 86} , 87} , { 88hl ( 'UnaryPlus' , '+' ), 89hl ( 'Register' , '@a' ), 90hl ( 'BinaryPlus' , '+' ), 91hl ( 'Register' , '@b' ), 92} ) 93check_parsing ( '+@a++@b' , { 94ast ={ 95{ 96'BinaryPlus:0:3:+' , 97children ={ 98{ 99'UnaryPlus:0:0:+' , 100children ={ 101'Register(name=a):0:1:@a' , 102} , 103} , 104{ 105'UnaryPlus:0:4:+' , 106children ={ 107'Register(name=b):0:5:@b' , 108} , 109} , 110} , 111} , 112} , 113} , { 114hl ( 'UnaryPlus' , '+' ), 115hl ( 'Register' , '@a' ), 116hl ( 'BinaryPlus' , '+' ), 117hl ( 'UnaryPlus' , '+' ), 118hl ( 'Register' , '@b' ), 119} ) 120check_parsing ( '@a@b' , { 121ast ={ 122{ 123'OpMissing:0:2:' , 124children ={ 125'Register(name=a):0:0:@a' , 126'Register(name=b):0:2:@b' , 127} , 128} , 129} , 130err ={ 131arg ='@b' , 132msg ='E15: Missing operator: %.*s' , 133} , 134} , { 135hl ( 'Register' , '@a' ), 136hl ( 'InvalidRegister' , '@b' ), 137} , { 138[ 1 ] ={ 139ast ={ 140len =2 , 141err =REMOVE_THIS , 142ast ={ 143'Register(name=a):0:0:@a' , 144} , 145} , 146hl_fs ={ 147[ 2 ] =REMOVE_THIS , 148} , 149} , 150} ) 151check_parsing ( ' @a \t @b' , { 152ast ={ 153{ 154'OpMissing:0:3:' , 155children ={ 156'Register(name=a):0:0: @a' , 157'Register(name=b):0:3: \t @b' , 158} , 159} , 160} , 161err ={ 162arg ='@b' , 163msg ='E15: Missing operator: %.*s' , 164} , 165} , { 166hl ( 'Register' , '@a' , 1 ), 167hl ( 'InvalidSpacing' , ' \t ' ), 168hl ( 'Register' , '@b' ), 169} , { 170[ 1 ] ={ 171ast ={ 172len =6 , 173err =REMOVE_THIS , 174ast ={ 175'Register(name=a):0:0: @a' , 176} , 177} , 178hl_fs ={ 179[ 2 ] =REMOVE_THIS , 180[ 3 ] =REMOVE_THIS , 181} , 182} , 183} ) 184check_parsing ( '+' , { 185ast ={ 186'UnaryPlus:0:0:+' , 187} , 188err ={ 189arg ='' , 190msg ='E15: Expected value, got EOC: %.*s' , 191} , 192} , { 193hl ( 'UnaryPlus' , '+' ), 194} ) 195check_parsing ( ' +' , { 196ast ={ 197'UnaryPlus:0:0: +' , 198} , 199err ={ 200arg ='' , 201msg ='E15: Expected value, got EOC: %.*s' , 202} , 203} , { 204hl ( 'UnaryPlus' , '+' , 1 ), 205} ) 206check_parsing ( '@a+ ' , { 207ast ={ 208{ 209'BinaryPlus:0:2:+' , 210children ={ 211'Register(name=a):0:0:@a' , 212} , 213} , 214} , 215err ={ 216arg ='' , 217msg ='E15: Expected value, got EOC: %.*s' , 218} , 219} , { 220hl ( 'Register' , '@a' ), 221hl ( 'BinaryPlus' , '+' ), 222} ) 223end ) 224itp ( 'works with @a, + and parenthesis' , function () 225check_parsing ( '(@a)' , { 226ast ={ 227{ 228'Nested:0:0:(' , 229children ={ 230'Register(name=a):0:1:@a' , 231} , 232} , 233} , 234} , { 235hl ( 'NestingParenthesis' , '(' ), 236hl ( 'Register' , '@a' ), 237hl ( 'NestingParenthesis' , ')' ), 238} ) 239check_parsing ( '()' , { 240ast ={ 241{ 242'Nested:0:0:(' , 243children ={ 244'Missing:0:1:' , 245} , 246} , 247} , 248err ={ 249arg =')' , 250msg ='E15: Expected value, got parenthesis: %.*s' , 251} , 252} , { 253hl ( 'NestingParenthesis' , '(' ), 254hl ( 'InvalidNestingParenthesis' , ')' ), 255} ) 256check_parsing ( ')' , { 257ast ={ 258{ 259'Nested:0:0:' , 260children ={ 261'Missing:0:0:' , 262} , 263} , 264} , 265err ={ 266arg =')' , 267msg ='E15: Expected value, got parenthesis: %.*s' , 268} , 269} , { 270hl ( 'InvalidNestingParenthesis' , ')' ), 271} ) 272check_parsing ( '+)' , { 273ast ={ 274{ 275'Nested:0:1:' , 276children ={ 277{ 278'UnaryPlus:0:0:+' , 279children ={ 280'Missing:0:1:' , 281} , 282} , 283} , 284} , 285} , 286err ={ 287arg =')' , 288msg ='E15: Expected value, got parenthesis: %.*s' , 289} , 290} , { 291hl ( 'UnaryPlus' , '+' ), 292hl ( 'InvalidNestingParenthesis' , ')' ), 293} ) 294check_parsing ( '+@a(@b)' , { 295ast ={ 296{ 297'UnaryPlus:0:0:+' , 298children ={ 299{ 300'Call:0:3:(' , 301children ={ 302'Register(name=a):0:1:@a' , 303'Register(name=b):0:4:@b' , 304} , 305} , 306} , 307} , 308} , 309} , { 310hl ( 'UnaryPlus' , '+' ), 311hl ( 'Register' , '@a' ), 312hl ( 'CallingParenthesis' , '(' ), 313hl ( 'Register' , '@b' ), 314hl ( 'CallingParenthesis' , ')' ), 315} ) 316check_parsing ( '@a+@b(@c)' , { 317ast ={ 318{ 319'BinaryPlus:0:2:+' , 320children ={ 321'Register(name=a):0:0:@a' , 322{ 323'Call:0:5:(' , 324children ={ 325'Register(name=b):0:3:@b' , 326'Register(name=c):0:6:@c' , 327} , 328} , 329} , 330} , 331} , 332} , { 333hl ( 'Register' , '@a' ), 334hl ( 'BinaryPlus' , '+' ), 335hl ( 'Register' , '@b' ), 336hl ( 'CallingParenthesis' , '(' ), 337hl ( 'Register' , '@c' ), 338hl ( 'CallingParenthesis' , ')' ), 339} ) 340check_parsing ( '@a()' , { 341ast ={ 342{ 343'Call:0:2:(' , 344children ={ 345'Register(name=a):0:0:@a' , 346} , 347} , 348} , 349} , { 350hl ( 'Register' , '@a' ), 351hl ( 'CallingParenthesis' , '(' ), 352hl ( 'CallingParenthesis' , ')' ), 353} ) 354check_parsing ( '@a ()' , { 355ast ={ 356{ 357'OpMissing:0:2:' , 358children ={ 359'Register(name=a):0:0:@a' , 360{ 361'Nested:0:2: (' , 362children ={ 363'Missing:0:4:' , 364} , 365} , 366} , 367} , 368} , 369err ={ 370arg ='()' , 371msg ='E15: Missing operator: %.*s' , 372} , 373} , { 374hl ( 'Register' , '@a' ), 375hl ( 'InvalidSpacing' , ' ' ), 376hl ( 'NestingParenthesis' , '(' ), 377hl ( 'InvalidNestingParenthesis' , ')' ), 378} , { 379[ 1 ] ={ 380ast ={ 381len =3 , 382err =REMOVE_THIS , 383ast ={ 384'Register(name=a):0:0:@a' , 385} , 386} , 387hl_fs ={ 388[ 2 ] =REMOVE_THIS , 389[ 3 ] =REMOVE_THIS , 390[ 4 ] =REMOVE_THIS , 391} , 392} , 393} ) 394check_parsing ( '@a + (@b)' , { 395ast ={ 396{ 397'BinaryPlus:0:2: +' , 398children ={ 399'Register(name=a):0:0:@a' , 400{ 401'Nested:0:4: (' , 402children ={ 403'Register(name=b):0:6:@b' , 404} , 405} , 406} , 407} , 408} , 409} , { 410hl ( 'Register' , '@a' ), 411hl ( 'BinaryPlus' , '+' , 1 ), 412hl ( 'NestingParenthesis' , '(' , 1 ), 413hl ( 'Register' , '@b' ), 414hl ( 'NestingParenthesis' , ')' ), 415} ) 416check_parsing ( '@a + (+@b)' , { 417ast ={ 418{ 419'BinaryPlus:0:2: +' , 420children ={ 421'Register(name=a):0:0:@a' , 422{ 423'Nested:0:4: (' , 424children ={ 425{ 426'UnaryPlus:0:6:+' , 427children ={ 428'Register(name=b):0:7:@b' , 429} , 430} , 431} , 432} , 433} , 434} , 435} , 436} , { 437hl ( 'Register' , '@a' ), 438hl ( 'BinaryPlus' , '+' , 1 ), 439hl ( 'NestingParenthesis' , '(' , 1 ), 440hl ( 'UnaryPlus' , '+' ), 441hl ( 'Register' , '@b' ), 442hl ( 'NestingParenthesis' , ')' ), 443} ) 444check_parsing ( '@a + (@b + @c)' , { 445ast ={ 446{ 447'BinaryPlus:0:2: +' , 448children ={ 449'Register(name=a):0:0:@a' , 450{ 451'Nested:0:4: (' , 452children ={ 453{ 454'BinaryPlus:0:8: +' , 455children ={ 456'Register(name=b):0:6:@b' , 457'Register(name=c):0:10: @c' , 458} , 459} , 460} , 461} , 462} , 463} , 464} , 465} , { 466hl ( 'Register' , '@a' ), 467hl ( 'BinaryPlus' , '+' , 1 ), 468hl ( 'NestingParenthesis' , '(' , 1 ), 469hl ( 'Register' , '@b' ), 470hl ( 'BinaryPlus' , '+' , 1 ), 471hl ( 'Register' , '@c' , 1 ), 472hl ( 'NestingParenthesis' , ')' ), 473} ) 474check_parsing ( '(@a)+@b' , { 475ast ={ 476{ 477'BinaryPlus:0:4:+' , 478children ={ 479{ 480'Nested:0:0:(' , 481children ={ 482'Register(name=a):0:1:@a' , 483} , 484} , 485'Register(name=b):0:5:@b' , 486} , 487} , 488} , 489} , { 490hl ( 'NestingParenthesis' , '(' ), 491hl ( 'Register' , '@a' ), 492hl ( 'NestingParenthesis' , ')' ), 493hl ( 'BinaryPlus' , '+' ), 494hl ( 'Register' , '@b' ), 495} ) 496check_parsing ( '@a+(@b)(@c)' , { 497-- 01234567890 498ast ={ 499{ 500'BinaryPlus:0:2:+' , 501children ={ 502'Register(name=a):0:0:@a' , 503{ 504'Call:0:7:(' , 505children ={ 506{ 507'Nested:0:3:(' , 508children ={ 'Register(name=b):0:4:@b' } , 509} , 510'Register(name=c):0:8:@c' , 511} , 512} , 513} , 514} , 515} , 516} , { 517hl ( 'Register' , '@a' ), 518hl ( 'BinaryPlus' , '+' ), 519hl ( 'NestingParenthesis' , '(' ), 520hl ( 'Register' , '@b' ), 521hl ( 'NestingParenthesis' , ')' ), 522hl ( 'CallingParenthesis' , '(' ), 523hl ( 'Register' , '@c' ), 524hl ( 'CallingParenthesis' , ')' ), 525} ) 526check_parsing ( '@a+((@b))(@c)' , { 527-- 01234567890123456890123456789 528-- 0 1 2 529ast ={ 530{ 531'BinaryPlus:0:2:+' , 532children ={ 533'Register(name=a):0:0:@a' , 534{ 535'Call:0:9:(' , 536children ={ 537{ 538'Nested:0:3:(' , 539children ={ 540{ 541'Nested:0:4:(' , 542children ={ 'Register(name=b):0:5:@b' } , 543} , 544} , 545} , 546'Register(name=c):0:10:@c' , 547} , 548} , 549} , 550} , 551} , 552} , { 553hl ( 'Register' , '@a' ), 554hl ( 'BinaryPlus' , '+' ), 555hl ( 'NestingParenthesis' , '(' ), 556hl ( 'NestingParenthesis' , '(' ), 557hl ( 'Register' , '@b' ), 558hl ( 'NestingParenthesis' , ')' ), 559hl ( 'NestingParenthesis' , ')' ), 560hl ( 'CallingParenthesis' , '(' ), 561hl ( 'Register' , '@c' ), 562hl ( 'CallingParenthesis' , ')' ), 563} ) 564check_parsing ( '@a+((@b))+@c' , { 565-- 01234567890123456890123456789 566-- 0 1 2 567ast ={ 568{ 569'BinaryPlus:0:9:+' , 570children ={ 571{ 572'BinaryPlus:0:2:+' , 573children ={ 574'Register(name=a):0:0:@a' , 575{ 576'Nested:0:3:(' , 577children ={ 578{ 579'Nested:0:4:(' , 580children ={ 'Register(name=b):0:5:@b' } , 581} , 582} , 583} , 584} , 585} , 586'Register(name=c):0:10:@c' , 587} , 588} , 589} , 590} , { 591hl ( 'Register' , '@a' ), 592hl ( 'BinaryPlus' , '+' ), 593hl ( 'NestingParenthesis' , '(' ), 594hl ( 'NestingParenthesis' , '(' ), 595hl ( 'Register' , '@b' ), 596hl ( 'NestingParenthesis' , ')' ), 597hl ( 'NestingParenthesis' , ')' ), 598hl ( 'BinaryPlus' , '+' ), 599hl ( 'Register' , '@c' ), 600} ) 601check_parsing ( '@a + (@b + @c) + @d(@e) + (+@f) + ((+@g(@h))(@j)(@k))(@l)' , { --[[ 602| | | | | | | | || | | || | | ||| || || || || 603000000000011111111112222222222333333333344444444445555555 604012345678901234567890123456789012345678901234567890123456 605]] 606ast ={ 607{ 608'BinaryPlus:0:31: +' , 609children ={ 610{ 611'BinaryPlus:0:23: +' , 612children ={ 613{ 614'BinaryPlus:0:14: +' , 615children ={ 616{ 617'BinaryPlus:0:2: +' , 618children ={ 619'Register(name=a):0:0:@a' , 620{ 621'Nested:0:4: (' , 622children ={ 623{ 624'BinaryPlus:0:8: +' , 625children ={ 626'Register(name=b):0:6:@b' , 627'Register(name=c):0:10: @c' , 628} , 629} , 630} , 631} , 632} , 633} , 634{ 635'Call:0:19:(' , 636children ={ 637'Register(name=d):0:16: @d' , 638'Register(name=e):0:20:@e' , 639} , 640} , 641} , 642} , 643{ 644'Nested:0:25: (' , 645children ={ 646{ 647'UnaryPlus:0:27:+' , 648children ={ 649'Register(name=f):0:28:@f' , 650} , 651} , 652} , 653} , 654} , 655} , 656{ 657'Call:0:53:(' , 658children ={ 659{ 660'Nested:0:33: (' , 661children ={ 662{ 663'Call:0:48:(' , 664children ={ 665{ 666'Call:0:44:(' , 667children ={ 668{ 669'Nested:0:35:(' , 670children ={ 671{ 672'UnaryPlus:0:36:+' , 673children ={ 674{ 675'Call:0:39:(' , 676children ={ 677'Register(name=g):0:37:@g' , 678'Register(name=h):0:40:@h' , 679} , 680} , 681} , 682} , 683} , 684} , 685'Register(name=j):0:45:@j' , 686} , 687} , 688'Register(name=k):0:49:@k' , 689} , 690} , 691} , 692} , 693'Register(name=l):0:54:@l' , 694} , 695} , 696} , 697} , 698} , 699} , { 700hl ( 'Register' , '@a' ), 701hl ( 'BinaryPlus' , '+' , 1 ), 702hl ( 'NestingParenthesis' , '(' , 1 ), 703hl ( 'Register' , '@b' ), 704hl ( 'BinaryPlus' , '+' , 1 ), 705hl ( 'Register' , '@c' , 1 ), 706hl ( 'NestingParenthesis' , ')' ), 707hl ( 'BinaryPlus' , '+' , 1 ), 708hl ( 'Register' , '@d' , 1 ), 709hl ( 'CallingParenthesis' , '(' ), 710hl ( 'Register' , '@e' ), 711hl ( 'CallingParenthesis' , ')' ), 712hl ( 'BinaryPlus' , '+' , 1 ), 713hl ( 'NestingParenthesis' , '(' , 1 ), 714hl ( 'UnaryPlus' , '+' ), 715hl ( 'Register' , '@f' ), 716hl ( 'NestingParenthesis' , ')' ), 717hl ( 'BinaryPlus' , '+' , 1 ), 718hl ( 'NestingParenthesis' , '(' , 1 ), 719hl ( 'NestingParenthesis' , '(' ), 720hl ( 'UnaryPlus' , '+' ), 721hl ( 'Register' , '@g' ), 722hl ( 'CallingParenthesis' , '(' ), 723hl ( 'Register' , '@h' ), 724hl ( 'CallingParenthesis' , ')' ), 725hl ( 'NestingParenthesis' , ')' ), 726hl ( 'CallingParenthesis' , '(' ), 727hl ( 'Register' , '@j' ), 728hl ( 'CallingParenthesis' , ')' ), 729hl ( 'CallingParenthesis' , '(' ), 730hl ( 'Register' , '@k' ), 731hl ( 'CallingParenthesis' , ')' ), 732hl ( 'NestingParenthesis' , ')' ), 733hl ( 'CallingParenthesis' , '(' ), 734hl ( 'Register' , '@l' ), 735hl ( 'CallingParenthesis' , ')' ), 736} ) 737check_parsing ( '@a)' , { 738-- 012 739ast ={ 740{ 741'Nested:0:2:' , 742children ={ 743'Register(name=a):0:0:@a' , 744} , 745} , 746} , 747err ={ 748arg =')' , 749msg ='E15: Unexpected closing parenthesis: %.*s' , 750} , 751} , { 752hl ( 'Register' , '@a' ), 753hl ( 'InvalidNestingParenthesis' , ')' ), 754} ) 755check_parsing ( '(@a' , { 756-- 012 757ast ={ 758{ 759'Nested:0:0:(' , 760children ={ 761'Register(name=a):0:1:@a' , 762} , 763} , 764} , 765err ={ 766arg ='(@a' , 767msg ='E110: Missing closing parenthesis for nested expression: %.*s' , 768} , 769} , { 770hl ( 'NestingParenthesis' , '(' ), 771hl ( 'Register' , '@a' ), 772} ) 773check_parsing ( '@a(@b' , { 774-- 01234 775ast ={ 776{ 777'Call:0:2:(' , 778children ={ 779'Register(name=a):0:0:@a' , 780'Register(name=b):0:3:@b' , 781} , 782} , 783} , 784err ={ 785arg ='(@b' , 786msg ='E116: Missing closing parenthesis for function call: %.*s' , 787} , 788} , { 789hl ( 'Register' , '@a' ), 790hl ( 'CallingParenthesis' , '(' ), 791hl ( 'Register' , '@b' ), 792} ) 793check_parsing ( '@a(@b, @c, @d, @e)' , { 794-- 012345678901234567 795-- 0 1 796ast ={ 797{ 798'Call:0:2:(' , 799children ={ 800'Register(name=a):0:0:@a' , 801{ 802'Comma:0:5:,' , 803children ={ 804'Register(name=b):0:3:@b' , 805{ 806'Comma:0:9:,' , 807children ={ 808'Register(name=c):0:6: @c' , 809{ 810'Comma:0:13:,' , 811children ={ 812'Register(name=d):0:10: @d' , 813'Register(name=e):0:14: @e' , 814} , 815} , 816} , 817} , 818} , 819} , 820} , 821} , 822} , 823} , { 824hl ( 'Register' , '@a' ), 825hl ( 'CallingParenthesis' , '(' ), 826hl ( 'Register' , '@b' ), 827hl ( 'Comma' , ',' ), 828hl ( 'Register' , '@c' , 1 ), 829hl ( 'Comma' , ',' ), 830hl ( 'Register' , '@d' , 1 ), 831hl ( 'Comma' , ',' ), 832hl ( 'Register' , '@e' , 1 ), 833hl ( 'CallingParenthesis' , ')' ), 834} ) 835check_parsing ( '@a(@b(@c))' , { 836-- 01234567890123456789012345678901234567 837-- 0 1 2 3 838ast ={ 839{ 840'Call:0:2:(' , 841children ={ 842'Register(name=a):0:0:@a' , 843{ 844'Call:0:5:(' , 845children ={ 846'Register(name=b):0:3:@b' , 847'Register(name=c):0:6:@c' , 848} , 849} , 850} , 851} , 852} , 853} , { 854hl ( 'Register' , '@a' ), 855hl ( 'CallingParenthesis' , '(' ), 856hl ( 'Register' , '@b' ), 857hl ( 'CallingParenthesis' , '(' ), 858hl ( 'Register' , '@c' ), 859hl ( 'CallingParenthesis' , ')' ), 860hl ( 'CallingParenthesis' , ')' ), 861} ) 862check_parsing ( '@a(@b(@c(@d(@e), @f(@g(@h), @i(@j)))))' , { 863-- 01234567890123456789012345678901234567 864-- 0 1 2 3 865ast ={ 866{ 867'Call:0:2:(' , 868children ={ 869'Register(name=a):0:0:@a' , 870{ 871'Call:0:5:(' , 872children ={ 873'Register(name=b):0:3:@b' , 874{ 875'Call:0:8:(' , 876children ={ 877'Register(name=c):0:6:@c' , 878{ 879'Comma:0:15:,' , 880children ={ 881{ 882'Call:0:11:(' , 883children ={ 884'Register(name=d):0:9:@d' , 885'Register(name=e):0:12:@e' , 886} , 887} , 888{ 889'Call:0:19:(' , 890children ={ 891'Register(name=f):0:16: @f' , 892{ 893'Comma:0:26:,' , 894children ={ 895{ 896'Call:0:22:(' , 897children ={ 898'Register(name=g):0:20:@g' , 899'Register(name=h):0:23:@h' , 900} , 901} , 902{ 903'Call:0:30:(' , 904children ={ 905'Register(name=i):0:27: @i' , 906'Register(name=j):0:31:@j' , 907} , 908} , 909} , 910} , 911} , 912} , 913} , 914} , 915} , 916} , 917} , 918} , 919} , 920} , 921} , 922} , { 923hl ( 'Register' , '@a' ), 924hl ( 'CallingParenthesis' , '(' ), 925hl ( 'Register' , '@b' ), 926hl ( 'CallingParenthesis' , '(' ), 927hl ( 'Register' , '@c' ), 928hl ( 'CallingParenthesis' , '(' ), 929hl ( 'Register' , '@d' ), 930hl ( 'CallingParenthesis' , '(' ), 931hl ( 'Register' , '@e' ), 932hl ( 'CallingParenthesis' , ')' ), 933hl ( 'Comma' , ',' ), 934hl ( 'Register' , '@f' , 1 ), 935hl ( 'CallingParenthesis' , '(' ), 936hl ( 'Register' , '@g' ), 937hl ( 'CallingParenthesis' , '(' ), 938hl ( 'Register' , '@h' ), 939hl ( 'CallingParenthesis' , ')' ), 940hl ( 'Comma' , ',' ), 941hl ( 'Register' , '@i' , 1 ), 942hl ( 'CallingParenthesis' , '(' ), 943hl ( 'Register' , '@j' ), 944hl ( 'CallingParenthesis' , ')' ), 945hl ( 'CallingParenthesis' , ')' ), 946hl ( 'CallingParenthesis' , ')' ), 947hl ( 'CallingParenthesis' , ')' ), 948hl ( 'CallingParenthesis' , ')' ), 949} ) 950check_parsing ( '()()' , { 951-- 0123 952ast ={ 953{ 954'Call:0:2:(' , 955children ={ 956{ 957'Nested:0:0:(' , 958children ={ 959'Missing:0:1:' , 960} , 961} , 962} , 963} , 964} , 965err ={ 966arg =')()' , 967msg ='E15: Expected value, got parenthesis: %.*s' , 968} , 969} , { 970hl ( 'NestingParenthesis' , '(' ), 971hl ( 'InvalidNestingParenthesis' , ')' ), 972hl ( 'CallingParenthesis' , '(' ), 973hl ( 'CallingParenthesis' , ')' ), 974} ) 975check_parsing ( '(@a)()' , { 976-- 012345 977ast ={ 978{ 979'Call:0:4:(' , 980children ={ 981{ 982'Nested:0:0:(' , 983children ={ 984'Register(name=a):0:1:@a' , 985} , 986} , 987} , 988} , 989} , 990} , { 991hl ( 'NestingParenthesis' , '(' ), 992hl ( 'Register' , '@a' ), 993hl ( 'NestingParenthesis' , ')' ), 994hl ( 'CallingParenthesis' , '(' ), 995hl ( 'CallingParenthesis' , ')' ), 996} ) 997check_parsing ( '(@a)(@b)' , { 998-- 01234567 999ast ={ 1000{ 1001'Call:0:4:(' , 1002children ={ 1003{ 1004'Nested:0:0:(' , 1005children ={ 1006'Register(name=a):0:1:@a' , 1007} , 1008} , 1009'Register(name=b):0:5:@b' , 1010} , 1011} , 1012} , 1013} , { 1014hl ( 'NestingParenthesis' , '(' ), 1015hl ( 'Register' , '@a' ), 1016hl ( 'NestingParenthesis' , ')' ), 1017hl ( 'CallingParenthesis' , '(' ), 1018hl ( 'Register' , '@b' ), 1019hl ( 'CallingParenthesis' , ')' ), 1020} ) 1021check_parsing ( '(@a) (@b)' , { 1022-- 012345678 1023ast ={ 1024{ 1025'OpMissing:0:4:' , 1026children ={ 1027{ 1028'Nested:0:0:(' , 1029children ={ 1030'Register(name=a):0:1:@a' , 1031} , 1032} , 1033{ 1034'Nested:0:4: (' , 1035children ={ 1036'Register(name=b):0:6:@b' , 1037} , 1038} , 1039} , 1040} , 1041} , 1042err ={ 1043arg ='(@b)' , 1044msg ='E15: Missing operator: %.*s' , 1045} , 1046} , { 1047hl ( 'NestingParenthesis' , '(' ), 1048hl ( 'Register' , '@a' ), 1049hl ( 'NestingParenthesis' , ')' ), 1050hl ( 'InvalidSpacing' , ' ' ), 1051hl ( 'NestingParenthesis' , '(' ), 1052hl ( 'Register' , '@b' ), 1053hl ( 'NestingParenthesis' , ')' ), 1054} , { 1055[ 1 ] ={ 1056ast ={ 1057len =5 , 1058ast ={ 1059{ 1060'Nested:0:0:(' , 1061children ={ 1062'Register(name=a):0:1:@a' , 1063REMOVE_THIS , 1064} , 1065} , 1066} , 1067err =REMOVE_THIS , 1068} , 1069hl_fs ={ 1070[ 4 ] =REMOVE_THIS , 1071[ 5 ] =REMOVE_THIS , 1072[ 6 ] =REMOVE_THIS , 1073[ 7 ] =REMOVE_THIS , 1074} , 1075} , 1076} ) 1077end ) 1078itp ( 'works with variable names, including curly braces ones' , function () 1079check_parsing ( 'var' , { 1080ast ={ 1081'PlainIdentifier(scope=0,ident=var):0:0:var' , 1082} , 1083} , { 1084hl ( 'IdentifierName' , 'var' ), 1085} ) 1086check_parsing ( 'g:var' , { 1087ast ={ 1088'PlainIdentifier(scope=g,ident=var):0:0:g:var' , 1089} , 1090} , { 1091hl ( 'IdentifierScope' , 'g' ), 1092hl ( 'IdentifierScopeDelimiter' , ':' ), 1093hl ( 'IdentifierName' , 'var' ), 1094} ) 1095check_parsing ( 'g:' , { 1096ast ={ 1097'PlainIdentifier(scope=g,ident=):0:0:g:' , 1098} , 1099} , { 1100hl ( 'IdentifierScope' , 'g' ), 1101hl ( 'IdentifierScopeDelimiter' , ':' ), 1102} ) 1103check_parsing ( '{a}' , { 1104-- 012 1105ast ={ 1106{ 1107fmtn ( 'CurlyBracesIdentifier' , '-di' , ':0:0:{' ), 1108children ={ 1109'PlainIdentifier(scope=0,ident=a):0:1:a' , 1110} , 1111} , 1112} , 1113} , { 1114hl ( 'Curly' , '{' ), 1115hl ( 'IdentifierName' , 'a' ), 1116hl ( 'Curly' , '}' ), 1117} ) 1118check_parsing ( '{a:b}' , { 1119-- 012 1120ast ={ 1121{ 1122fmtn ( 'CurlyBracesIdentifier' , '-di' , ':0:0:{' ), 1123children ={ 1124'PlainIdentifier(scope=a,ident=b):0:1:a:b' , 1125} , 1126} , 1127} , 1128} , { 1129hl ( 'Curly' , '{' ), 1130hl ( 'IdentifierScope' , 'a' ), 1131hl ( 'IdentifierScopeDelimiter' , ':' ), 1132hl ( 'IdentifierName' , 'b' ), 1133hl ( 'Curly' , '}' ), 1134} ) 1135check_parsing ( '{a:@b}' , { 1136-- 012345 1137ast ={ 1138{ 1139fmtn ( 'CurlyBracesIdentifier' , '-di' , ':0:0:{' ), 1140children ={ 1141{ 1142'OpMissing:0:3:' , 1143children ={ 1144'PlainIdentifier(scope=a,ident=):0:1:a:' , 1145'Register(name=b):0:3:@b' , 1146} , 1147} , 1148} , 1149} , 1150} , 1151err ={ 1152arg ='@b}' , 1153msg ='E15: Missing operator: %.*s' , 1154} , 1155} , { 1156hl ( 'Curly' , '{' ), 1157hl ( 'IdentifierScope' , 'a' ), 1158hl ( 'IdentifierScopeDelimiter' , ':' ), 1159hl ( 'InvalidRegister' , '@b' ), 1160hl ( 'Curly' , '}' ), 1161} ) 1162check_parsing ( '{@a}' , { 1163ast ={ 1164{ 1165fmtn ( 'CurlyBracesIdentifier' , '-di' , ':0:0:{' ), 1166children ={ 1167'Register(name=a):0:1:@a' , 1168} , 1169} , 1170} , 1171} , { 1172hl ( 'Curly' , '{' ), 1173hl ( 'Register' , '@a' ), 1174hl ( 'Curly' , '}' ), 1175} ) 1176check_parsing ( '{@a}{@b}' , { 1177-- 01234567 1178ast ={ 1179{ 1180'ComplexIdentifier:0:4:' , 1181children ={ 1182{ 1183fmtn ( 'CurlyBracesIdentifier' , '-di' , ':0:0:{' ), 1184children ={ 1185'Register(name=a):0:1:@a' , 1186} , 1187} , 1188{ 1189fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:4:{' ), 1190children ={ 1191'Register(name=b):0:5:@b' , 1192} , 1193} , 1194} , 1195} , 1196} , 1197} , { 1198hl ( 'Curly' , '{' ), 1199hl ( 'Register' , '@a' ), 1200hl ( 'Curly' , '}' ), 1201hl ( 'Curly' , '{' ), 1202hl ( 'Register' , '@b' ), 1203hl ( 'Curly' , '}' ), 1204} ) 1205check_parsing ( 'g:{@a}' , { 1206-- 01234567 1207ast ={ 1208{ 1209'ComplexIdentifier:0:2:' , 1210children ={ 1211'PlainIdentifier(scope=g,ident=):0:0:g:' , 1212{ 1213fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:2:{' ), 1214children ={ 1215'Register(name=a):0:3:@a' , 1216} , 1217} , 1218} , 1219} , 1220} , 1221} , { 1222hl ( 'IdentifierScope' , 'g' ), 1223hl ( 'IdentifierScopeDelimiter' , ':' ), 1224hl ( 'Curly' , '{' ), 1225hl ( 'Register' , '@a' ), 1226hl ( 'Curly' , '}' ), 1227} ) 1228check_parsing ( '{@a}_test' , { 1229-- 012345678 1230ast ={ 1231{ 1232'ComplexIdentifier:0:4:' , 1233children ={ 1234{ 1235fmtn ( 'CurlyBracesIdentifier' , '-di' , ':0:0:{' ), 1236children ={ 1237'Register(name=a):0:1:@a' , 1238} , 1239} , 1240'PlainIdentifier(scope=0,ident=_test):0:4:_test' , 1241} , 1242} , 1243} , 1244} , { 1245hl ( 'Curly' , '{' ), 1246hl ( 'Register' , '@a' ), 1247hl ( 'Curly' , '}' ), 1248hl ( 'IdentifierName' , '_test' ), 1249} ) 1250check_parsing ( 'g:{@a}_test' , { 1251-- 01234567890 1252ast ={ 1253{ 1254'ComplexIdentifier:0:2:' , 1255children ={ 1256'PlainIdentifier(scope=g,ident=):0:0:g:' , 1257{ 1258'ComplexIdentifier:0:6:' , 1259children ={ 1260{ 1261fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:2:{' ), 1262children ={ 1263'Register(name=a):0:3:@a' , 1264} , 1265} , 1266'PlainIdentifier(scope=0,ident=_test):0:6:_test' , 1267} , 1268} , 1269} , 1270} , 1271} , 1272} , { 1273hl ( 'IdentifierScope' , 'g' ), 1274hl ( 'IdentifierScopeDelimiter' , ':' ), 1275hl ( 'Curly' , '{' ), 1276hl ( 'Register' , '@a' ), 1277hl ( 'Curly' , '}' ), 1278hl ( 'IdentifierName' , '_test' ), 1279} ) 1280check_parsing ( 'g:{@a}_test()' , { 1281-- 0123456789012 1282ast ={ 1283{ 1284'Call:0:11:(' , 1285children ={ 1286{ 1287'ComplexIdentifier:0:2:' , 1288children ={ 1289'PlainIdentifier(scope=g,ident=):0:0:g:' , 1290{ 1291'ComplexIdentifier:0:6:' , 1292children ={ 1293{ 1294fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:2:{' ), 1295children ={ 1296'Register(name=a):0:3:@a' , 1297} , 1298} , 1299'PlainIdentifier(scope=0,ident=_test):0:6:_test' , 1300} , 1301} , 1302} , 1303} , 1304} , 1305} , 1306} , 1307} , { 1308hl ( 'IdentifierScope' , 'g' ), 1309hl ( 'IdentifierScopeDelimiter' , ':' ), 1310hl ( 'Curly' , '{' ), 1311hl ( 'Register' , '@a' ), 1312hl ( 'Curly' , '}' ), 1313hl ( 'IdentifierName' , '_test' ), 1314hl ( 'CallingParenthesis' , '(' ), 1315hl ( 'CallingParenthesis' , ')' ), 1316} ) 1317check_parsing ( '{@a} ()' , { 1318-- 0123456789012 1319ast ={ 1320{ 1321'Call:0:4: (' , 1322children ={ 1323{ 1324fmtn ( 'CurlyBracesIdentifier' , '-di' , ':0:0:{' ), 1325children ={ 1326'Register(name=a):0:1:@a' , 1327} , 1328} , 1329} , 1330} , 1331} , 1332} , { 1333hl ( 'Curly' , '{' ), 1334hl ( 'Register' , '@a' ), 1335hl ( 'Curly' , '}' ), 1336hl ( 'CallingParenthesis' , '(' , 1 ), 1337hl ( 'CallingParenthesis' , ')' ), 1338} ) 1339check_parsing ( 'g:{@a} ()' , { 1340-- 0123456789012 1341ast ={ 1342{ 1343'Call:0:6: (' , 1344children ={ 1345{ 1346'ComplexIdentifier:0:2:' , 1347children ={ 1348'PlainIdentifier(scope=g,ident=):0:0:g:' , 1349{ 1350fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:2:{' ), 1351children ={ 1352'Register(name=a):0:3:@a' , 1353} , 1354} , 1355} , 1356} , 1357} , 1358} , 1359} , 1360} , { 1361hl ( 'IdentifierScope' , 'g' ), 1362hl ( 'IdentifierScopeDelimiter' , ':' ), 1363hl ( 'Curly' , '{' ), 1364hl ( 'Register' , '@a' ), 1365hl ( 'Curly' , '}' ), 1366hl ( 'CallingParenthesis' , '(' , 1 ), 1367hl ( 'CallingParenthesis' , ')' ), 1368} ) 1369check_parsing ( '{@a' , { 1370-- 012 1371ast ={ 1372{ 1373fmtn ( 'UnknownFigure' , '-di' , ':0:0:{' ), 1374children ={ 1375'Register(name=a):0:1:@a' , 1376} , 1377} , 1378} , 1379err ={ 1380arg ='{@a' , 1381msg ='E15: Missing closing figure brace: %.*s' , 1382} , 1383} , { 1384hl ( 'FigureBrace' , '{' ), 1385hl ( 'Register' , '@a' ), 1386} ) 1387check_parsing ( 'a ()' , { 1388-- 0123 1389ast ={ 1390{ 1391'Call:0:1: (' , 1392children ={ 1393'PlainIdentifier(scope=0,ident=a):0:0:a' , 1394} , 1395} , 1396} , 1397} , { 1398hl ( 'IdentifierName' , 'a' ), 1399hl ( 'CallingParenthesis' , '(' , 1 ), 1400hl ( 'CallingParenthesis' , ')' ), 1401} ) 1402end ) 1403itp ( 'works with lambdas and dictionaries' , function () 1404check_parsing ( '{}' , { 1405ast ={ 1406fmtn ( 'DictLiteral' , '-di' , ':0:0:{' ), 1407} , 1408} , { 1409hl ( 'Dict' , '{' ), 1410hl ( 'Dict' , '}' ), 1411} ) 1412check_parsing ( '{->@a}' , { 1413ast ={ 1414{ 1415fmtn ( 'Lambda' , '\\di' , ':0:0:{' ), 1416children ={ 1417{ 1418'Arrow:0:1:->' , 1419children ={ 1420'Register(name=a):0:3:@a' , 1421} , 1422} , 1423} , 1424} , 1425} , 1426} , { 1427hl ( 'Lambda' , '{' ), 1428hl ( 'Arrow' , '->' ), 1429hl ( 'Register' , '@a' ), 1430hl ( 'Lambda' , '}' ), 1431} ) 1432check_parsing ( '{->@a+@b}' , { 1433-- 012345678 1434ast ={ 1435{ 1436fmtn ( 'Lambda' , '\\di' , ':0:0:{' ), 1437children ={ 1438{ 1439'Arrow:0:1:->' , 1440children ={ 1441{ 1442'BinaryPlus:0:5:+' , 1443children ={ 1444'Register(name=a):0:3:@a' , 1445'Register(name=b):0:6:@b' , 1446} , 1447} , 1448} , 1449} , 1450} , 1451} , 1452} , 1453} , { 1454hl ( 'Lambda' , '{' ), 1455hl ( 'Arrow' , '->' ), 1456hl ( 'Register' , '@a' ), 1457hl ( 'BinaryPlus' , '+' ), 1458hl ( 'Register' , '@b' ), 1459hl ( 'Lambda' , '}' ), 1460} ) 1461check_parsing ( '{a->@a}' , { 1462-- 012345678 1463ast ={ 1464{ 1465fmtn ( 'Lambda' , '\\di' , ':0:0:{' ), 1466children ={ 1467'PlainIdentifier(scope=0,ident=a):0:1:a' , 1468{ 1469'Arrow:0:2:->' , 1470children ={ 1471'Register(name=a):0:4:@a' , 1472} , 1473} , 1474} , 1475} , 1476} , 1477} , { 1478hl ( 'Lambda' , '{' ), 1479hl ( 'IdentifierName' , 'a' ), 1480hl ( 'Arrow' , '->' ), 1481hl ( 'Register' , '@a' ), 1482hl ( 'Lambda' , '}' ), 1483} ) 1484check_parsing ( '{a,b->@a}' , { 1485-- 012345678 1486ast ={ 1487{ 1488fmtn ( 'Lambda' , '\\di' , ':0:0:{' ), 1489children ={ 1490{ 1491'Comma:0:2:,' , 1492children ={ 1493'PlainIdentifier(scope=0,ident=a):0:1:a' , 1494'PlainIdentifier(scope=0,ident=b):0:3:b' , 1495} , 1496} , 1497{ 1498'Arrow:0:4:->' , 1499children ={ 1500'Register(name=a):0:6:@a' , 1501} , 1502} , 1503} , 1504} , 1505} , 1506} , { 1507hl ( 'Lambda' , '{' ), 1508hl ( 'IdentifierName' , 'a' ), 1509hl ( 'Comma' , ',' ), 1510hl ( 'IdentifierName' , 'b' ), 1511hl ( 'Arrow' , '->' ), 1512hl ( 'Register' , '@a' ), 1513hl ( 'Lambda' , '}' ), 1514} ) 1515check_parsing ( '{a,b,c->@a}' , { 1516-- 01234567890 1517ast ={ 1518{ 1519fmtn ( 'Lambda' , '\\di' , ':0:0:{' ), 1520children ={ 1521{ 1522'Comma:0:2:,' , 1523children ={ 1524'PlainIdentifier(scope=0,ident=a):0:1:a' , 1525{ 1526'Comma:0:4:,' , 1527children ={ 1528'PlainIdentifier(scope=0,ident=b):0:3:b' , 1529'PlainIdentifier(scope=0,ident=c):0:5:c' , 1530} , 1531} , 1532} , 1533} , 1534{ 1535'Arrow:0:6:->' , 1536children ={ 1537'Register(name=a):0:8:@a' , 1538} , 1539} , 1540} , 1541} , 1542} , 1543} , { 1544hl ( 'Lambda' , '{' ), 1545hl ( 'IdentifierName' , 'a' ), 1546hl ( 'Comma' , ',' ), 1547hl ( 'IdentifierName' , 'b' ), 1548hl ( 'Comma' , ',' ), 1549hl ( 'IdentifierName' , 'c' ), 1550hl ( 'Arrow' , '->' ), 1551hl ( 'Register' , '@a' ), 1552hl ( 'Lambda' , '}' ), 1553} ) 1554check_parsing ( '{a,b,c,d->@a}' , { 1555-- 0123456789012 1556ast ={ 1557{ 1558fmtn ( 'Lambda' , '\\di' , ':0:0:{' ), 1559children ={ 1560{ 1561'Comma:0:2:,' , 1562children ={ 1563'PlainIdentifier(scope=0,ident=a):0:1:a' , 1564{ 1565'Comma:0:4:,' , 1566children ={ 1567'PlainIdentifier(scope=0,ident=b):0:3:b' , 1568{ 1569'Comma:0:6:,' , 1570children ={ 1571'PlainIdentifier(scope=0,ident=c):0:5:c' , 1572'PlainIdentifier(scope=0,ident=d):0:7:d' , 1573} , 1574} , 1575} , 1576} , 1577} , 1578} , 1579{ 1580'Arrow:0:8:->' , 1581children ={ 1582'Register(name=a):0:10:@a' , 1583} , 1584} , 1585} , 1586} , 1587} , 1588} , { 1589hl ( 'Lambda' , '{' ), 1590hl ( 'IdentifierName' , 'a' ), 1591hl ( 'Comma' , ',' ), 1592hl ( 'IdentifierName' , 'b' ), 1593hl ( 'Comma' , ',' ), 1594hl ( 'IdentifierName' , 'c' ), 1595hl ( 'Comma' , ',' ), 1596hl ( 'IdentifierName' , 'd' ), 1597hl ( 'Arrow' , '->' ), 1598hl ( 'Register' , '@a' ), 1599hl ( 'Lambda' , '}' ), 1600} ) 1601check_parsing ( '{a,b,c,d,->@a}' , { 1602-- 01234567890123 1603ast ={ 1604{ 1605fmtn ( 'Lambda' , '\\di' , ':0:0:{' ), 1606children ={ 1607{ 1608'Comma:0:2:,' , 1609children ={ 1610'PlainIdentifier(scope=0,ident=a):0:1:a' , 1611{ 1612'Comma:0:4:,' , 1613children ={ 1614'PlainIdentifier(scope=0,ident=b):0:3:b' , 1615{ 1616'Comma:0:6:,' , 1617children ={ 1618'PlainIdentifier(scope=0,ident=c):0:5:c' , 1619{ 1620'Comma:0:8:,' , 1621children ={ 1622'PlainIdentifier(scope=0,ident=d):0:7:d' , 1623} , 1624} , 1625} , 1626} , 1627} , 1628} , 1629} , 1630} , 1631{ 1632'Arrow:0:9:->' , 1633children ={ 1634'Register(name=a):0:11:@a' , 1635} , 1636} , 1637} , 1638} , 1639} , 1640} , { 1641hl ( 'Lambda' , '{' ), 1642hl ( 'IdentifierName' , 'a' ), 1643hl ( 'Comma' , ',' ), 1644hl ( 'IdentifierName' , 'b' ), 1645hl ( 'Comma' , ',' ), 1646hl ( 'IdentifierName' , 'c' ), 1647hl ( 'Comma' , ',' ), 1648hl ( 'IdentifierName' , 'd' ), 1649hl ( 'Comma' , ',' ), 1650hl ( 'Arrow' , '->' ), 1651hl ( 'Register' , '@a' ), 1652hl ( 'Lambda' , '}' ), 1653} ) 1654check_parsing ( '{a,b->{c,d->{e,f->@a}}}' , { 1655-- 01234567890123456789012 1656-- 0 1 2 1657ast ={ 1658{ 1659fmtn ( 'Lambda' , '\\di' , ':0:0:{' ), 1660children ={ 1661{ 1662'Comma:0:2:,' , 1663children ={ 1664'PlainIdentifier(scope=0,ident=a):0:1:a' , 1665'PlainIdentifier(scope=0,ident=b):0:3:b' , 1666} , 1667} , 1668{ 1669'Arrow:0:4:->' , 1670children ={ 1671{ 1672fmtn ( 'Lambda' , '\\di' , ':0:6:{' ), 1673children ={ 1674{ 1675'Comma:0:8:,' , 1676children ={ 1677'PlainIdentifier(scope=0,ident=c):0:7:c' , 1678'PlainIdentifier(scope=0,ident=d):0:9:d' , 1679} , 1680} , 1681{ 1682'Arrow:0:10:->' , 1683children ={ 1684{ 1685fmtn ( 'Lambda' , '\\di' , ':0:12:{' ), 1686children ={ 1687{ 1688'Comma:0:14:,' , 1689children ={ 1690'PlainIdentifier(scope=0,ident=e):0:13:e' , 1691'PlainIdentifier(scope=0,ident=f):0:15:f' , 1692} , 1693} , 1694{ 1695'Arrow:0:16:->' , 1696children ={ 1697'Register(name=a):0:18:@a' , 1698} , 1699} , 1700} , 1701} , 1702} , 1703} , 1704} , 1705} , 1706} , 1707} , 1708} , 1709} , 1710} , 1711} , { 1712hl ( 'Lambda' , '{' ), 1713hl ( 'IdentifierName' , 'a' ), 1714hl ( 'Comma' , ',' ), 1715hl ( 'IdentifierName' , 'b' ), 1716hl ( 'Arrow' , '->' ), 1717hl ( 'Lambda' , '{' ), 1718hl ( 'IdentifierName' , 'c' ), 1719hl ( 'Comma' , ',' ), 1720hl ( 'IdentifierName' , 'd' ), 1721hl ( 'Arrow' , '->' ), 1722hl ( 'Lambda' , '{' ), 1723hl ( 'IdentifierName' , 'e' ), 1724hl ( 'Comma' , ',' ), 1725hl ( 'IdentifierName' , 'f' ), 1726hl ( 'Arrow' , '->' ), 1727hl ( 'Register' , '@a' ), 1728hl ( 'Lambda' , '}' ), 1729hl ( 'Lambda' , '}' ), 1730hl ( 'Lambda' , '}' ), 1731} ) 1732check_parsing ( '{a,b->c,d}' , { 1733-- 0123456789 1734ast ={ 1735{ 1736fmtn ( 'Lambda' , '\\di' , ':0:0:{' ), 1737children ={ 1738{ 1739'Comma:0:2:,' , 1740children ={ 1741'PlainIdentifier(scope=0,ident=a):0:1:a' , 1742'PlainIdentifier(scope=0,ident=b):0:3:b' , 1743} , 1744} , 1745{ 1746'Arrow:0:4:->' , 1747children ={ 1748{ 1749'Comma:0:7:,' , 1750children ={ 1751'PlainIdentifier(scope=0,ident=c):0:6:c' , 1752'PlainIdentifier(scope=0,ident=d):0:8:d' , 1753} , 1754} , 1755} , 1756} , 1757} , 1758} , 1759} , 1760err ={ 1761arg =',d}' , 1762msg ='E15: Comma outside of call, lambda or literal: %.*s' , 1763} , 1764} , { 1765hl ( 'Lambda' , '{' ), 1766hl ( 'IdentifierName' , 'a' ), 1767hl ( 'Comma' , ',' ), 1768hl ( 'IdentifierName' , 'b' ), 1769hl ( 'Arrow' , '->' ), 1770hl ( 'IdentifierName' , 'c' ), 1771hl ( 'InvalidComma' , ',' ), 1772hl ( 'IdentifierName' , 'd' ), 1773hl ( 'Lambda' , '}' ), 1774} ) 1775check_parsing ( 'a,b,c,d' , { 1776-- 0123456789 1777ast ={ 1778{ 1779'Comma:0:1:,' , 1780children ={ 1781'PlainIdentifier(scope=0,ident=a):0:0:a' , 1782{ 1783'Comma:0:3:,' , 1784children ={ 1785'PlainIdentifier(scope=0,ident=b):0:2:b' , 1786{ 1787'Comma:0:5:,' , 1788children ={ 1789'PlainIdentifier(scope=0,ident=c):0:4:c' , 1790'PlainIdentifier(scope=0,ident=d):0:6:d' , 1791} , 1792} , 1793} , 1794} , 1795} , 1796} , 1797} , 1798err ={ 1799arg =',b,c,d' , 1800msg ='E15: Comma outside of call, lambda or literal: %.*s' , 1801} , 1802} , { 1803hl ( 'IdentifierName' , 'a' ), 1804hl ( 'InvalidComma' , ',' ), 1805hl ( 'IdentifierName' , 'b' ), 1806hl ( 'InvalidComma' , ',' ), 1807hl ( 'IdentifierName' , 'c' ), 1808hl ( 'InvalidComma' , ',' ), 1809hl ( 'IdentifierName' , 'd' ), 1810} ) 1811check_parsing ( 'a,b,c,d,' , { 1812-- 0123456789 1813ast ={ 1814{ 1815'Comma:0:1:,' , 1816children ={ 1817'PlainIdentifier(scope=0,ident=a):0:0:a' , 1818{ 1819'Comma:0:3:,' , 1820children ={ 1821'PlainIdentifier(scope=0,ident=b):0:2:b' , 1822{ 1823'Comma:0:5:,' , 1824children ={ 1825'PlainIdentifier(scope=0,ident=c):0:4:c' , 1826{ 1827'Comma:0:7:,' , 1828children ={ 1829'PlainIdentifier(scope=0,ident=d):0:6:d' , 1830} , 1831} , 1832} , 1833} , 1834} , 1835} , 1836} , 1837} , 1838} , 1839err ={ 1840arg =',b,c,d,' , 1841msg ='E15: Comma outside of call, lambda or literal: %.*s' , 1842} , 1843} , { 1844hl ( 'IdentifierName' , 'a' ), 1845hl ( 'InvalidComma' , ',' ), 1846hl ( 'IdentifierName' , 'b' ), 1847hl ( 'InvalidComma' , ',' ), 1848hl ( 'IdentifierName' , 'c' ), 1849hl ( 'InvalidComma' , ',' ), 1850hl ( 'IdentifierName' , 'd' ), 1851hl ( 'InvalidComma' , ',' ), 1852} ) 1853check_parsing ( ',' , { 1854-- 0123456789 1855ast ={ 1856{ 1857'Comma:0:0:,' , 1858children ={ 1859'Missing:0:0:' , 1860} , 1861} , 1862} , 1863err ={ 1864arg =',' , 1865msg ='E15: Expected value, got comma: %.*s' , 1866} , 1867} , { 1868hl ( 'InvalidComma' , ',' ), 1869} ) 1870check_parsing ( '{,a->@a}' , { 1871-- 0123456789 1872ast ={ 1873{ 1874fmtn ( 'CurlyBracesIdentifier' , '-di' , ':0:0:{' ), 1875children ={ 1876{ 1877'Arrow:0:3:->' , 1878children ={ 1879{ 1880'Comma:0:1:,' , 1881children ={ 1882'Missing:0:1:' , 1883'PlainIdentifier(scope=0,ident=a):0:2:a' , 1884} , 1885} , 1886'Register(name=a):0:5:@a' , 1887} , 1888} , 1889} , 1890} , 1891} , 1892err ={ 1893arg =',a->@a}' , 1894msg ='E15: Expected value, got comma: %.*s' , 1895} , 1896} , { 1897hl ( 'Curly' , '{' ), 1898hl ( 'InvalidComma' , ',' ), 1899hl ( 'IdentifierName' , 'a' ), 1900hl ( 'InvalidArrow' , '->' ), 1901hl ( 'Register' , '@a' ), 1902hl ( 'Curly' , '}' ), 1903} ) 1904check_parsing ( '}' , { 1905-- 0123456789 1906ast ={ 1907fmtn ( 'UnknownFigure' , '---' , ':0:0:' ), 1908} , 1909err ={ 1910arg ='}' , 1911msg ='E15: Unexpected closing figure brace: %.*s' , 1912} , 1913} , { 1914hl ( 'InvalidFigureBrace' , '}' ), 1915} ) 1916check_parsing ( '{->}' , { 1917-- 0123456789 1918ast ={ 1919{ 1920fmtn ( 'Lambda' , '\\di' , ':0:0:{' ), 1921children ={ 1922'Arrow:0:1:->' , 1923} , 1924} , 1925} , 1926err ={ 1927arg ='}' , 1928msg ='E15: Expected value, got closing figure brace: %.*s' , 1929} , 1930} , { 1931hl ( 'Lambda' , '{' ), 1932hl ( 'Arrow' , '->' ), 1933hl ( 'InvalidLambda' , '}' ), 1934} ) 1935check_parsing ( '{a,b}' , { 1936-- 0123456789 1937ast ={ 1938{ 1939fmtn ( 'Lambda' , '-di' , ':0:0:{' ), 1940children ={ 1941{ 1942'Comma:0:2:,' , 1943children ={ 1944'PlainIdentifier(scope=0,ident=a):0:1:a' , 1945'PlainIdentifier(scope=0,ident=b):0:3:b' , 1946} , 1947} , 1948} , 1949} , 1950} , 1951err ={ 1952arg ='}' , 1953msg ='E15: Expected lambda arguments list or arrow: %.*s' , 1954} , 1955} , { 1956hl ( 'Lambda' , '{' ), 1957hl ( 'IdentifierName' , 'a' ), 1958hl ( 'Comma' , ',' ), 1959hl ( 'IdentifierName' , 'b' ), 1960hl ( 'InvalidLambda' , '}' ), 1961} ) 1962check_parsing ( '{a,}' , { 1963-- 0123456789 1964ast ={ 1965{ 1966fmtn ( 'Lambda' , '-di' , ':0:0:{' ), 1967children ={ 1968{ 1969'Comma:0:2:,' , 1970children ={ 1971'PlainIdentifier(scope=0,ident=a):0:1:a' , 1972} , 1973} , 1974} , 1975} , 1976} , 1977err ={ 1978arg ='}' , 1979msg ='E15: Expected lambda arguments list or arrow: %.*s' , 1980} , 1981} , { 1982hl ( 'Lambda' , '{' ), 1983hl ( 'IdentifierName' , 'a' ), 1984hl ( 'Comma' , ',' ), 1985hl ( 'InvalidLambda' , '}' ), 1986} ) 1987check_parsing ( '{@a:@b}' , { 1988-- 0123456789 1989ast ={ 1990{ 1991fmtn ( 'DictLiteral' , '-di' , ':0:0:{' ), 1992children ={ 1993{ 1994'Colon:0:3::' , 1995children ={ 1996'Register(name=a):0:1:@a' , 1997'Register(name=b):0:4:@b' , 1998} , 1999} , 2000} , 2001} , 2002} , 2003} , { 2004hl ( 'Dict' , '{' ), 2005hl ( 'Register' , '@a' ), 2006hl ( 'Colon' , ':' ), 2007hl ( 'Register' , '@b' ), 2008hl ( 'Dict' , '}' ), 2009} ) 2010check_parsing ( '{@a:@b,@c:@d}' , { 2011-- 0123456789012 2012-- 0 1 2013ast ={ 2014{ 2015fmtn ( 'DictLiteral' , '-di' , ':0:0:{' ), 2016children ={ 2017{ 2018'Comma:0:6:,' , 2019children ={ 2020{ 2021'Colon:0:3::' , 2022children ={ 2023'Register(name=a):0:1:@a' , 2024'Register(name=b):0:4:@b' , 2025} , 2026} , 2027{ 2028'Colon:0:9::' , 2029children ={ 2030'Register(name=c):0:7:@c' , 2031'Register(name=d):0:10:@d' , 2032} , 2033} , 2034} , 2035} , 2036} , 2037} , 2038} , 2039} , { 2040hl ( 'Dict' , '{' ), 2041hl ( 'Register' , '@a' ), 2042hl ( 'Colon' , ':' ), 2043hl ( 'Register' , '@b' ), 2044hl ( 'Comma' , ',' ), 2045hl ( 'Register' , '@c' ), 2046hl ( 'Colon' , ':' ), 2047hl ( 'Register' , '@d' ), 2048hl ( 'Dict' , '}' ), 2049} ) 2050check_parsing ( '{@a:@b,@c:@d,@e:@f,}' , { 2051-- 01234567890123456789 2052-- 0 1 2053ast ={ 2054{ 2055fmtn ( 'DictLiteral' , '-di' , ':0:0:{' ), 2056children ={ 2057{ 2058'Comma:0:6:,' , 2059children ={ 2060{ 2061'Colon:0:3::' , 2062children ={ 2063'Register(name=a):0:1:@a' , 2064'Register(name=b):0:4:@b' , 2065} , 2066} , 2067{ 2068'Comma:0:12:,' , 2069children ={ 2070{ 2071'Colon:0:9::' , 2072children ={ 2073'Register(name=c):0:7:@c' , 2074'Register(name=d):0:10:@d' , 2075} , 2076} , 2077{ 2078'Comma:0:18:,' , 2079children ={ 2080{ 2081'Colon:0:15::' , 2082children ={ 2083'Register(name=e):0:13:@e' , 2084'Register(name=f):0:16:@f' , 2085} , 2086} , 2087} , 2088} , 2089} , 2090} , 2091} , 2092} , 2093} , 2094} , 2095} , 2096} , { 2097hl ( 'Dict' , '{' ), 2098hl ( 'Register' , '@a' ), 2099hl ( 'Colon' , ':' ), 2100hl ( 'Register' , '@b' ), 2101hl ( 'Comma' , ',' ), 2102hl ( 'Register' , '@c' ), 2103hl ( 'Colon' , ':' ), 2104hl ( 'Register' , '@d' ), 2105hl ( 'Comma' , ',' ), 2106hl ( 'Register' , '@e' ), 2107hl ( 'Colon' , ':' ), 2108hl ( 'Register' , '@f' ), 2109hl ( 'Comma' , ',' ), 2110hl ( 'Dict' , '}' ), 2111} ) 2112check_parsing ( '{@a:@b,@c:@d,@e:@f,@g:}' , { 2113-- 01234567890123456789012 2114-- 0 1 2 2115ast ={ 2116{ 2117fmtn ( 'DictLiteral' , '-di' , ':0:0:{' ), 2118children ={ 2119{ 2120'Comma:0:6:,' , 2121children ={ 2122{ 2123'Colon:0:3::' , 2124children ={ 2125'Register(name=a):0:1:@a' , 2126'Register(name=b):0:4:@b' , 2127} , 2128} , 2129{ 2130'Comma:0:12:,' , 2131children ={ 2132{ 2133'Colon:0:9::' , 2134children ={ 2135'Register(name=c):0:7:@c' , 2136'Register(name=d):0:10:@d' , 2137} , 2138} , 2139{ 2140'Comma:0:18:,' , 2141children ={ 2142{ 2143'Colon:0:15::' , 2144children ={ 2145'Register(name=e):0:13:@e' , 2146'Register(name=f):0:16:@f' , 2147} , 2148} , 2149{ 2150'Colon:0:21::' , 2151children ={ 2152'Register(name=g):0:19:@g' , 2153} , 2154} , 2155} , 2156} , 2157} , 2158} , 2159} , 2160} , 2161} , 2162} , 2163} , 2164err ={ 2165arg ='}' , 2166msg ='E15: Expected value, got closing figure brace: %.*s' , 2167} , 2168} , { 2169hl ( 'Dict' , '{' ), 2170hl ( 'Register' , '@a' ), 2171hl ( 'Colon' , ':' ), 2172hl ( 'Register' , '@b' ), 2173hl ( 'Comma' , ',' ), 2174hl ( 'Register' , '@c' ), 2175hl ( 'Colon' , ':' ), 2176hl ( 'Register' , '@d' ), 2177hl ( 'Comma' , ',' ), 2178hl ( 'Register' , '@e' ), 2179hl ( 'Colon' , ':' ), 2180hl ( 'Register' , '@f' ), 2181hl ( 'Comma' , ',' ), 2182hl ( 'Register' , '@g' ), 2183hl ( 'Colon' , ':' ), 2184hl ( 'InvalidDict' , '}' ), 2185} ) 2186check_parsing ( '{@a:@b,}' , { 2187-- 01234567890123 2188-- 0 1 2189ast ={ 2190{ 2191fmtn ( 'DictLiteral' , '-di' , ':0:0:{' ), 2192children ={ 2193{ 2194'Comma:0:6:,' , 2195children ={ 2196{ 2197'Colon:0:3::' , 2198children ={ 2199'Register(name=a):0:1:@a' , 2200'Register(name=b):0:4:@b' , 2201} , 2202} , 2203} , 2204} , 2205} , 2206} , 2207} , 2208} , { 2209hl ( 'Dict' , '{' ), 2210hl ( 'Register' , '@a' ), 2211hl ( 'Colon' , ':' ), 2212hl ( 'Register' , '@b' ), 2213hl ( 'Comma' , ',' ), 2214hl ( 'Dict' , '}' ), 2215} ) 2216check_parsing ( '{({f -> g})(@h)(@i)}' , { 2217-- 01234567890123456789 2218-- 0 1 2219ast ={ 2220{ 2221fmtn ( 'CurlyBracesIdentifier' , '-di' , ':0:0:{' ), 2222children ={ 2223{ 2224'Call:0:15:(' , 2225children ={ 2226{ 2227'Call:0:11:(' , 2228children ={ 2229{ 2230'Nested:0:1:(' , 2231children ={ 2232{ 2233fmtn ( 'Lambda' , '\\di' , ':0:2:{' ), 2234children ={ 2235'PlainIdentifier(scope=0,ident=f):0:3:f' , 2236{ 2237'Arrow:0:4: ->' , 2238children ={ 2239'PlainIdentifier(scope=0,ident=g):0:7: g' , 2240} , 2241} , 2242} , 2243} , 2244} , 2245} , 2246'Register(name=h):0:12:@h' , 2247} , 2248} , 2249'Register(name=i):0:16:@i' , 2250} , 2251} , 2252} , 2253} , 2254} , 2255} , { 2256hl ( 'Curly' , '{' ), 2257hl ( 'NestingParenthesis' , '(' ), 2258hl ( 'Lambda' , '{' ), 2259hl ( 'IdentifierName' , 'f' ), 2260hl ( 'Arrow' , '->' , 1 ), 2261hl ( 'IdentifierName' , 'g' , 1 ), 2262hl ( 'Lambda' , '}' ), 2263hl ( 'NestingParenthesis' , ')' ), 2264hl ( 'CallingParenthesis' , '(' ), 2265hl ( 'Register' , '@h' ), 2266hl ( 'CallingParenthesis' , ')' ), 2267hl ( 'CallingParenthesis' , '(' ), 2268hl ( 'Register' , '@i' ), 2269hl ( 'CallingParenthesis' , ')' ), 2270hl ( 'Curly' , '}' ), 2271} ) 2272check_parsing ( 'a:{b()}c' , { 2273-- 01234567 2274ast ={ 2275{ 2276'ComplexIdentifier:0:2:' , 2277children ={ 2278'PlainIdentifier(scope=a,ident=):0:0:a:' , 2279{ 2280'ComplexIdentifier:0:7:' , 2281children ={ 2282{ 2283fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:2:{' ), 2284children ={ 2285{ 2286'Call:0:4:(' , 2287children ={ 2288'PlainIdentifier(scope=0,ident=b):0:3:b' , 2289} , 2290} , 2291} , 2292} , 2293'PlainIdentifier(scope=0,ident=c):0:7:c' , 2294} , 2295} , 2296} , 2297} , 2298} , 2299} , { 2300hl ( 'IdentifierScope' , 'a' ), 2301hl ( 'IdentifierScopeDelimiter' , ':' ), 2302hl ( 'Curly' , '{' ), 2303hl ( 'IdentifierName' , 'b' ), 2304hl ( 'CallingParenthesis' , '(' ), 2305hl ( 'CallingParenthesis' , ')' ), 2306hl ( 'Curly' , '}' ), 2307hl ( 'IdentifierName' , 'c' ), 2308} ) 2309check_parsing ( 'a:{{b, c -> @d + @e + ({f -> g})(@h)}(@i)}j' , { 2310-- 01234567890123456789012345678901234567890123456 2311-- 0 1 2 3 4 2312ast ={ 2313{ 2314'ComplexIdentifier:0:2:' , 2315children ={ 2316'PlainIdentifier(scope=a,ident=):0:0:a:' , 2317{ 2318'ComplexIdentifier:0:42:' , 2319children ={ 2320{ 2321fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:2:{' ), 2322children ={ 2323{ 2324'Call:0:37:(' , 2325children ={ 2326{ 2327fmtn ( 'Lambda' , '\\di' , ':0:3:{' ), 2328children ={ 2329{ 2330'Comma:0:5:,' , 2331children ={ 2332'PlainIdentifier(scope=0,ident=b):0:4:b' , 2333'PlainIdentifier(scope=0,ident=c):0:6: c' , 2334} , 2335} , 2336{ 2337'Arrow:0:8: ->' , 2338children ={ 2339{ 2340'BinaryPlus:0:19: +' , 2341children ={ 2342{ 2343'BinaryPlus:0:14: +' , 2344children ={ 2345'Register(name=d):0:11: @d' , 2346'Register(name=e):0:16: @e' , 2347} , 2348} , 2349{ 2350'Call:0:32:(' , 2351children ={ 2352{ 2353'Nested:0:21: (' , 2354children ={ 2355{ 2356fmtn ( 'Lambda' , '\\di' , ':0:23:{' ), 2357children ={ 2358'PlainIdentifier(scope=0,ident=f):0:24:f' , 2359{ 2360'Arrow:0:25: ->' , 2361children ={ 2362'PlainIdentifier(scope=0,ident=g):0:28: g' , 2363} , 2364} , 2365} , 2366} , 2367} , 2368} , 2369'Register(name=h):0:33:@h' , 2370} , 2371} , 2372} , 2373} , 2374} , 2375} , 2376} , 2377} , 2378'Register(name=i):0:38:@i' , 2379} , 2380} , 2381} , 2382} , 2383'PlainIdentifier(scope=0,ident=j):0:42:j' , 2384} , 2385} , 2386} , 2387} , 2388} , 2389} , { 2390hl ( 'IdentifierScope' , 'a' ), 2391hl ( 'IdentifierScopeDelimiter' , ':' ), 2392hl ( 'Curly' , '{' ), 2393hl ( 'Lambda' , '{' ), 2394hl ( 'IdentifierName' , 'b' ), 2395hl ( 'Comma' , ',' ), 2396hl ( 'IdentifierName' , 'c' , 1 ), 2397hl ( 'Arrow' , '->' , 1 ), 2398hl ( 'Register' , '@d' , 1 ), 2399hl ( 'BinaryPlus' , '+' , 1 ), 2400hl ( 'Register' , '@e' , 1 ), 2401hl ( 'BinaryPlus' , '+' , 1 ), 2402hl ( 'NestingParenthesis' , '(' , 1 ), 2403hl ( 'Lambda' , '{' ), 2404hl ( 'IdentifierName' , 'f' ), 2405hl ( 'Arrow' , '->' , 1 ), 2406hl ( 'IdentifierName' , 'g' , 1 ), 2407hl ( 'Lambda' , '}' ), 2408hl ( 'NestingParenthesis' , ')' ), 2409hl ( 'CallingParenthesis' , '(' ), 2410hl ( 'Register' , '@h' ), 2411hl ( 'CallingParenthesis' , ')' ), 2412hl ( 'Lambda' , '}' ), 2413hl ( 'CallingParenthesis' , '(' ), 2414hl ( 'Register' , '@i' ), 2415hl ( 'CallingParenthesis' , ')' ), 2416hl ( 'Curly' , '}' ), 2417hl ( 'IdentifierName' , 'j' ), 2418} ) 2419check_parsing ( '{@a + @b : @c + @d, @e + @f : @g + @i}' , { 2420-- 01234567890123456789012345678901234567 2421-- 0 1 2 3 2422ast ={ 2423{ 2424fmtn ( 'DictLiteral' , '-di' , ':0:0:{' ), 2425children ={ 2426{ 2427'Comma:0:18:,' , 2428children ={ 2429{ 2430'Colon:0:8: :' , 2431children ={ 2432{ 2433'BinaryPlus:0:3: +' , 2434children ={ 2435'Register(name=a):0:1:@a' , 2436'Register(name=b):0:5: @b' , 2437} , 2438} , 2439{ 2440'BinaryPlus:0:13: +' , 2441children ={ 2442'Register(name=c):0:10: @c' , 2443'Register(name=d):0:15: @d' , 2444} , 2445} , 2446} , 2447} , 2448{ 2449'Colon:0:27: :' , 2450children ={ 2451{ 2452'BinaryPlus:0:22: +' , 2453children ={ 2454'Register(name=e):0:19: @e' , 2455'Register(name=f):0:24: @f' , 2456} , 2457} , 2458{ 2459'BinaryPlus:0:32: +' , 2460children ={ 2461'Register(name=g):0:29: @g' , 2462'Register(name=i):0:34: @i' , 2463} , 2464} , 2465} , 2466} , 2467} , 2468} , 2469} , 2470} , 2471} , 2472} , { 2473hl ( 'Dict' , '{' ), 2474hl ( 'Register' , '@a' ), 2475hl ( 'BinaryPlus' , '+' , 1 ), 2476hl ( 'Register' , '@b' , 1 ), 2477hl ( 'Colon' , ':' , 1 ), 2478hl ( 'Register' , '@c' , 1 ), 2479hl ( 'BinaryPlus' , '+' , 1 ), 2480hl ( 'Register' , '@d' , 1 ), 2481hl ( 'Comma' , ',' ), 2482hl ( 'Register' , '@e' , 1 ), 2483hl ( 'BinaryPlus' , '+' , 1 ), 2484hl ( 'Register' , '@f' , 1 ), 2485hl ( 'Colon' , ':' , 1 ), 2486hl ( 'Register' , '@g' , 1 ), 2487hl ( 'BinaryPlus' , '+' , 1 ), 2488hl ( 'Register' , '@i' , 1 ), 2489hl ( 'Dict' , '}' ), 2490} ) 2491check_parsing ( '-> -> ->' , { 2492-- 01234567 2493ast ={ 2494{ 2495'Arrow:0:0:->' , 2496children ={ 2497'Missing:0:0:' , 2498{ 2499'Arrow:0:2: ->' , 2500children ={ 2501'Missing:0:2:' , 2502{ 2503'Arrow:0:5: ->' , 2504children ={ 2505'Missing:0:5:' , 2506} , 2507} , 2508} , 2509} , 2510} , 2511} , 2512} , 2513err ={ 2514arg ='-> -> ->' , 2515msg ='E15: Unexpected arrow: %.*s' , 2516} , 2517} , { 2518hl ( 'InvalidArrow' , '->' ), 2519hl ( 'InvalidArrow' , '->' , 1 ), 2520hl ( 'InvalidArrow' , '->' , 1 ), 2521} ) 2522check_parsing ( 'a -> b -> c -> d' , { 2523-- 0123456789012345 2524-- 0 1 2525ast ={ 2526{ 2527'Arrow:0:1: ->' , 2528children ={ 2529'PlainIdentifier(scope=0,ident=a):0:0:a' , 2530{ 2531'Arrow:0:6: ->' , 2532children ={ 2533'PlainIdentifier(scope=0,ident=b):0:4: b' , 2534{ 2535'Arrow:0:11: ->' , 2536children ={ 2537'PlainIdentifier(scope=0,ident=c):0:9: c' , 2538'PlainIdentifier(scope=0,ident=d):0:14: d' , 2539} , 2540} , 2541} , 2542} , 2543} , 2544} , 2545} , 2546err ={ 2547arg ='-> b -> c -> d' , 2548msg ='E15: Arrow outside of lambda: %.*s' , 2549} , 2550} , { 2551hl ( 'IdentifierName' , 'a' ), 2552hl ( 'InvalidArrow' , '->' , 1 ), 2553hl ( 'IdentifierName' , 'b' , 1 ), 2554hl ( 'InvalidArrow' , '->' , 1 ), 2555hl ( 'IdentifierName' , 'c' , 1 ), 2556hl ( 'InvalidArrow' , '->' , 1 ), 2557hl ( 'IdentifierName' , 'd' , 1 ), 2558} ) 2559check_parsing ( '{a -> b -> c}' , { 2560-- 0123456789012 2561-- 0 1 2562ast ={ 2563{ 2564fmtn ( 'Lambda' , '\\di' , ':0:0:{' ), 2565children ={ 2566'PlainIdentifier(scope=0,ident=a):0:1:a' , 2567{ 2568'Arrow:0:2: ->' , 2569children ={ 2570{ 2571'Arrow:0:7: ->' , 2572children ={ 2573'PlainIdentifier(scope=0,ident=b):0:5: b' , 2574'PlainIdentifier(scope=0,ident=c):0:10: c' , 2575} , 2576} , 2577} , 2578} , 2579} , 2580} , 2581} , 2582err ={ 2583arg ='-> c}' , 2584msg ='E15: Arrow outside of lambda: %.*s' , 2585} , 2586} , { 2587hl ( 'Lambda' , '{' ), 2588hl ( 'IdentifierName' , 'a' ), 2589hl ( 'Arrow' , '->' , 1 ), 2590hl ( 'IdentifierName' , 'b' , 1 ), 2591hl ( 'InvalidArrow' , '->' , 1 ), 2592hl ( 'IdentifierName' , 'c' , 1 ), 2593hl ( 'Lambda' , '}' ), 2594} ) 2595check_parsing ( '{a: -> b}' , { 2596-- 012345678 2597ast ={ 2598{ 2599fmtn ( 'CurlyBracesIdentifier' , '-di' , ':0:0:{' ), 2600children ={ 2601{ 2602'Arrow:0:3: ->' , 2603children ={ 2604'PlainIdentifier(scope=a,ident=):0:1:a:' , 2605'PlainIdentifier(scope=0,ident=b):0:6: b' , 2606} , 2607} , 2608} , 2609} , 2610} , 2611err ={ 2612arg ='-> b}' , 2613msg ='E15: Arrow outside of lambda: %.*s' , 2614} , 2615} , { 2616hl ( 'Curly' , '{' ), 2617hl ( 'IdentifierScope' , 'a' ), 2618hl ( 'IdentifierScopeDelimiter' , ':' ), 2619hl ( 'InvalidArrow' , '->' , 1 ), 2620hl ( 'IdentifierName' , 'b' , 1 ), 2621hl ( 'Curly' , '}' ), 2622} ) 2623 2624check_parsing ( '{a:b -> b}' , { 2625-- 0123456789 2626ast ={ 2627{ 2628fmtn ( 'CurlyBracesIdentifier' , '-di' , ':0:0:{' ), 2629children ={ 2630{ 2631'Arrow:0:4: ->' , 2632children ={ 2633'PlainIdentifier(scope=a,ident=b):0:1:a:b' , 2634'PlainIdentifier(scope=0,ident=b):0:7: b' , 2635} , 2636} , 2637} , 2638} , 2639} , 2640err ={ 2641arg ='-> b}' , 2642msg ='E15: Arrow outside of lambda: %.*s' , 2643} , 2644} , { 2645hl ( 'Curly' , '{' ), 2646hl ( 'IdentifierScope' , 'a' ), 2647hl ( 'IdentifierScopeDelimiter' , ':' ), 2648hl ( 'IdentifierName' , 'b' ), 2649hl ( 'InvalidArrow' , '->' , 1 ), 2650hl ( 'IdentifierName' , 'b' , 1 ), 2651hl ( 'Curly' , '}' ), 2652} ) 2653 2654check_parsing ( '{a#b -> b}' , { 2655-- 0123456789 2656ast ={ 2657{ 2658fmtn ( 'CurlyBracesIdentifier' , '-di' , ':0:0:{' ), 2659children ={ 2660{ 2661'Arrow:0:4: ->' , 2662children ={ 2663'PlainIdentifier(scope=0,ident=a#b):0:1:a#b' , 2664'PlainIdentifier(scope=0,ident=b):0:7: b' , 2665} , 2666} , 2667} , 2668} , 2669} , 2670err ={ 2671arg ='-> b}' , 2672msg ='E15: Arrow outside of lambda: %.*s' , 2673} , 2674} , { 2675hl ( 'Curly' , '{' ), 2676hl ( 'IdentifierName' , 'a#b' ), 2677hl ( 'InvalidArrow' , '->' , 1 ), 2678hl ( 'IdentifierName' , 'b' , 1 ), 2679hl ( 'Curly' , '}' ), 2680} ) 2681check_parsing ( '{a : b : c}' , { 2682-- 01234567890 2683-- 0 1 2684ast ={ 2685{ 2686fmtn ( 'DictLiteral' , '-di' , ':0:0:{' ), 2687children ={ 2688{ 2689'Colon:0:2: :' , 2690children ={ 2691'PlainIdentifier(scope=0,ident=a):0:1:a' , 2692{ 2693'Colon:0:6: :' , 2694children ={ 2695'PlainIdentifier(scope=0,ident=b):0:4: b' , 2696'PlainIdentifier(scope=0,ident=c):0:8: c' , 2697} , 2698} , 2699} , 2700} , 2701} , 2702} , 2703} , 2704err ={ 2705arg =': c}' , 2706msg ='E15: Colon outside of dictionary or ternary operator: %.*s' , 2707} , 2708} , { 2709hl ( 'Dict' , '{' ), 2710hl ( 'IdentifierName' , 'a' ), 2711hl ( 'Colon' , ':' , 1 ), 2712hl ( 'IdentifierName' , 'b' , 1 ), 2713hl ( 'InvalidColon' , ':' , 1 ), 2714hl ( 'IdentifierName' , 'c' , 1 ), 2715hl ( 'Dict' , '}' ), 2716} ) 2717check_parsing ( '{' , { 2718-- 0 2719ast ={ 2720fmtn ( 'UnknownFigure' , '\\di' , ':0:0:{' ), 2721} , 2722err ={ 2723arg ='{' , 2724msg ='E15: Missing closing figure brace: %.*s' , 2725} , 2726} , { 2727hl ( 'FigureBrace' , '{' ), 2728} ) 2729check_parsing ( '{a' , { 2730-- 01 2731ast ={ 2732{ 2733fmtn ( 'UnknownFigure' , '\\di' , ':0:0:{' ), 2734children ={ 2735'PlainIdentifier(scope=0,ident=a):0:1:a' , 2736} , 2737} , 2738} , 2739err ={ 2740arg ='{a' , 2741msg ='E15: Missing closing figure brace: %.*s' , 2742} , 2743} , { 2744hl ( 'FigureBrace' , '{' ), 2745hl ( 'IdentifierName' , 'a' ), 2746} ) 2747check_parsing ( '{a,b' , { 2748-- 0123 2749ast ={ 2750{ 2751fmtn ( 'Lambda' , '\\di' , ':0:0:{' ), 2752children ={ 2753{ 2754'Comma:0:2:,' , 2755children ={ 2756'PlainIdentifier(scope=0,ident=a):0:1:a' , 2757'PlainIdentifier(scope=0,ident=b):0:3:b' , 2758} , 2759} , 2760} , 2761} , 2762} , 2763err ={ 2764arg ='{a,b' , 2765msg ='E15: Missing closing figure brace for lambda: %.*s' , 2766} , 2767} , { 2768hl ( 'Lambda' , '{' ), 2769hl ( 'IdentifierName' , 'a' ), 2770hl ( 'Comma' , ',' ), 2771hl ( 'IdentifierName' , 'b' ), 2772} ) 2773check_parsing ( '{a,b->' , { 2774-- 012345 2775ast ={ 2776{ 2777fmtn ( 'Lambda' , '\\di' , ':0:0:{' ), 2778children ={ 2779{ 2780'Comma:0:2:,' , 2781children ={ 2782'PlainIdentifier(scope=0,ident=a):0:1:a' , 2783'PlainIdentifier(scope=0,ident=b):0:3:b' , 2784} , 2785} , 2786'Arrow:0:4:->' , 2787} , 2788} , 2789} , 2790err ={ 2791arg ='' , 2792msg ='E15: Expected value, got EOC: %.*s' , 2793} , 2794} , { 2795hl ( 'Lambda' , '{' ), 2796hl ( 'IdentifierName' , 'a' ), 2797hl ( 'Comma' , ',' ), 2798hl ( 'IdentifierName' , 'b' ), 2799hl ( 'Arrow' , '->' ), 2800} ) 2801check_parsing ( '{a,b->c' , { 2802-- 0123456 2803ast ={ 2804{ 2805fmtn ( 'Lambda' , '\\di' , ':0:0:{' ), 2806children ={ 2807{ 2808'Comma:0:2:,' , 2809children ={ 2810'PlainIdentifier(scope=0,ident=a):0:1:a' , 2811'PlainIdentifier(scope=0,ident=b):0:3:b' , 2812} , 2813} , 2814{ 2815'Arrow:0:4:->' , 2816children ={ 2817'PlainIdentifier(scope=0,ident=c):0:6:c' , 2818} , 2819} , 2820} , 2821} , 2822} , 2823err ={ 2824arg ='{a,b->c' , 2825msg ='E15: Missing closing figure brace for lambda: %.*s' , 2826} , 2827} , { 2828hl ( 'Lambda' , '{' ), 2829hl ( 'IdentifierName' , 'a' ), 2830hl ( 'Comma' , ',' ), 2831hl ( 'IdentifierName' , 'b' ), 2832hl ( 'Arrow' , '->' ), 2833hl ( 'IdentifierName' , 'c' ), 2834} ) 2835check_parsing ( '{a : b' , { 2836-- 012345 2837ast ={ 2838{ 2839fmtn ( 'DictLiteral' , '-di' , ':0:0:{' ), 2840children ={ 2841{ 2842'Colon:0:2: :' , 2843children ={ 2844'PlainIdentifier(scope=0,ident=a):0:1:a' , 2845'PlainIdentifier(scope=0,ident=b):0:4: b' , 2846} , 2847} , 2848} , 2849} , 2850} , 2851err ={ 2852arg ='{a : b' , 2853msg ="E723: Missing end of Dictionary '}': %.*s" , 2854} , 2855} , { 2856hl ( 'Dict' , '{' ), 2857hl ( 'IdentifierName' , 'a' ), 2858hl ( 'Colon' , ':' , 1 ), 2859hl ( 'IdentifierName' , 'b' , 1 ), 2860} ) 2861check_parsing ( '{a : b,' , { 2862-- 0123456 2863ast ={ 2864{ 2865fmtn ( 'DictLiteral' , '-di' , ':0:0:{' ), 2866children ={ 2867{ 2868'Comma:0:6:,' , 2869children ={ 2870{ 2871'Colon:0:2: :' , 2872children ={ 2873'PlainIdentifier(scope=0,ident=a):0:1:a' , 2874'PlainIdentifier(scope=0,ident=b):0:4: b' , 2875} , 2876} , 2877} , 2878} , 2879} , 2880} , 2881} , 2882err ={ 2883arg ='' , 2884msg ='E15: Expected value, got EOC: %.*s' , 2885} , 2886} , { 2887hl ( 'Dict' , '{' ), 2888hl ( 'IdentifierName' , 'a' ), 2889hl ( 'Colon' , ':' , 1 ), 2890hl ( 'IdentifierName' , 'b' , 1 ), 2891hl ( 'Comma' , ',' ), 2892} ) 2893end ) 2894itp ( 'works with ternary operator' , function () 2895check_parsing ( 'a ? b : c' , { 2896-- 012345678 2897ast ={ 2898{ 2899'Ternary:0:1: ?' , 2900children ={ 2901'PlainIdentifier(scope=0,ident=a):0:0:a' , 2902{ 2903'TernaryValue:0:5: :' , 2904children ={ 2905'PlainIdentifier(scope=0,ident=b):0:3: b' , 2906'PlainIdentifier(scope=0,ident=c):0:7: c' , 2907} , 2908} , 2909} , 2910} , 2911} , 2912} , { 2913hl ( 'IdentifierName' , 'a' ), 2914hl ( 'Ternary' , '?' , 1 ), 2915hl ( 'IdentifierName' , 'b' , 1 ), 2916hl ( 'TernaryColon' , ':' , 1 ), 2917hl ( 'IdentifierName' , 'c' , 1 ), 2918} ) 2919check_parsing ( '@a?@b?@c:@d:@e' , { 2920-- 01234567890123 2921-- 0 1 2922ast ={ 2923{ 2924'Ternary:0:2:?' , 2925children ={ 2926'Register(name=a):0:0:@a' , 2927{ 2928'TernaryValue:0:11::' , 2929children ={ 2930{ 2931'Ternary:0:5:?' , 2932children ={ 2933'Register(name=b):0:3:@b' , 2934{ 2935'TernaryValue:0:8::' , 2936children ={ 2937'Register(name=c):0:6:@c' , 2938'Register(name=d):0:9:@d' , 2939} , 2940} , 2941} , 2942} , 2943'Register(name=e):0:12:@e' , 2944} , 2945} , 2946} , 2947} , 2948} , 2949} , { 2950hl ( 'Register' , '@a' ), 2951hl ( 'Ternary' , '?' ), 2952hl ( 'Register' , '@b' ), 2953hl ( 'Ternary' , '?' ), 2954hl ( 'Register' , '@c' ), 2955hl ( 'TernaryColon' , ':' ), 2956hl ( 'Register' , '@d' ), 2957hl ( 'TernaryColon' , ':' ), 2958hl ( 'Register' , '@e' ), 2959} ) 2960check_parsing ( '@a?@b:@c?@d:@e' , { 2961-- 01234567890123 2962-- 0 1 2963ast ={ 2964{ 2965'Ternary:0:2:?' , 2966children ={ 2967'Register(name=a):0:0:@a' , 2968{ 2969'TernaryValue:0:5::' , 2970children ={ 2971'Register(name=b):0:3:@b' , 2972{ 2973'Ternary:0:8:?' , 2974children ={ 2975'Register(name=c):0:6:@c' , 2976{ 2977'TernaryValue:0:11::' , 2978children ={ 2979'Register(name=d):0:9:@d' , 2980'Register(name=e):0:12:@e' , 2981} , 2982} , 2983} , 2984} , 2985} , 2986} , 2987} , 2988} , 2989} , 2990} , { 2991hl ( 'Register' , '@a' ), 2992hl ( 'Ternary' , '?' ), 2993hl ( 'Register' , '@b' ), 2994hl ( 'TernaryColon' , ':' ), 2995hl ( 'Register' , '@c' ), 2996hl ( 'Ternary' , '?' ), 2997hl ( 'Register' , '@d' ), 2998hl ( 'TernaryColon' , ':' ), 2999hl ( 'Register' , '@e' ), 3000} ) 3001check_parsing ( '@a?@b?@c?@d:@e?@f:@g:@h?@i:@j:@k' , { 3002-- 01234567890123456789012345678901 3003-- 0 1 2 3 3004ast ={ 3005{ 3006'Ternary:0:2:?' , 3007children ={ 3008'Register(name=a):0:0:@a' , 3009{ 3010'TernaryValue:0:29::' , 3011children ={ 3012{ 3013'Ternary:0:5:?' , 3014children ={ 3015'Register(name=b):0:3:@b' , 3016{ 3017'TernaryValue:0:20::' , 3018children ={ 3019{ 3020'Ternary:0:8:?' , 3021children ={ 3022'Register(name=c):0:6:@c' , 3023{ 3024'TernaryValue:0:11::' , 3025children ={ 3026'Register(name=d):0:9:@d' , 3027{ 3028'Ternary:0:14:?' , 3029children ={ 3030'Register(name=e):0:12:@e' , 3031{ 3032'TernaryValue:0:17::' , 3033children ={ 3034'Register(name=f):0:15:@f' , 3035'Register(name=g):0:18:@g' , 3036} , 3037} , 3038} , 3039} , 3040} , 3041} , 3042} , 3043} , 3044{ 3045'Ternary:0:23:?' , 3046children ={ 3047'Register(name=h):0:21:@h' , 3048{ 3049'TernaryValue:0:26::' , 3050children ={ 3051'Register(name=i):0:24:@i' , 3052'Register(name=j):0:27:@j' , 3053} , 3054} , 3055} , 3056} , 3057} , 3058} , 3059} , 3060} , 3061'Register(name=k):0:30:@k' , 3062} , 3063} , 3064} , 3065} , 3066} , 3067} , { 3068hl ( 'Register' , '@a' ), 3069hl ( 'Ternary' , '?' ), 3070hl ( 'Register' , '@b' ), 3071hl ( 'Ternary' , '?' ), 3072hl ( 'Register' , '@c' ), 3073hl ( 'Ternary' , '?' ), 3074hl ( 'Register' , '@d' ), 3075hl ( 'TernaryColon' , ':' ), 3076hl ( 'Register' , '@e' ), 3077hl ( 'Ternary' , '?' ), 3078hl ( 'Register' , '@f' ), 3079hl ( 'TernaryColon' , ':' ), 3080hl ( 'Register' , '@g' ), 3081hl ( 'TernaryColon' , ':' ), 3082hl ( 'Register' , '@h' ), 3083hl ( 'Ternary' , '?' ), 3084hl ( 'Register' , '@i' ), 3085hl ( 'TernaryColon' , ':' ), 3086hl ( 'Register' , '@j' ), 3087hl ( 'TernaryColon' , ':' ), 3088hl ( 'Register' , '@k' ), 3089} ) 3090check_parsing ( '?' , { 3091-- 0 3092ast ={ 3093{ 3094'Ternary:0:0:?' , 3095children ={ 3096'Missing:0:0:' , 3097'TernaryValue:0:0:?' , 3098} , 3099} , 3100} , 3101err ={ 3102arg ='?' , 3103msg ='E15: Expected value, got question mark: %.*s' , 3104} , 3105} , { 3106hl ( 'InvalidTernary' , '?' ), 3107} ) 3108 3109check_parsing ( '?:' , { 3110-- 01 3111ast ={ 3112{ 3113'Ternary:0:0:?' , 3114children ={ 3115'Missing:0:0:' , 3116{ 3117'TernaryValue:0:1::' , 3118children ={ 3119'Missing:0:1:' , 3120} , 3121} , 3122} , 3123} , 3124} , 3125err ={ 3126arg ='?:' , 3127msg ='E15: Expected value, got question mark: %.*s' , 3128} , 3129} , { 3130hl ( 'InvalidTernary' , '?' ), 3131hl ( 'InvalidTernaryColon' , ':' ), 3132} ) 3133 3134check_parsing ( '?::' , { 3135-- 012 3136ast ={ 3137{ 3138'Colon:0:2::' , 3139children ={ 3140{ 3141'Ternary:0:0:?' , 3142children ={ 3143'Missing:0:0:' , 3144{ 3145'TernaryValue:0:1::' , 3146children ={ 3147'Missing:0:1:' , 3148'Missing:0:2:' , 3149} , 3150} , 3151} , 3152} , 3153} , 3154} , 3155} , 3156err ={ 3157arg ='?::' , 3158msg ='E15: Expected value, got question mark: %.*s' , 3159} , 3160} , { 3161hl ( 'InvalidTernary' , '?' ), 3162hl ( 'InvalidTernaryColon' , ':' ), 3163hl ( 'InvalidColon' , ':' ), 3164} ) 3165 3166check_parsing ( 'a?b' , { 3167-- 012 3168ast ={ 3169{ 3170'Ternary:0:1:?' , 3171children ={ 3172'PlainIdentifier(scope=0,ident=a):0:0:a' , 3173{ 3174'TernaryValue:0:1:?' , 3175children ={ 3176'PlainIdentifier(scope=0,ident=b):0:2:b' , 3177} , 3178} , 3179} , 3180} , 3181} , 3182err ={ 3183arg ='?b' , 3184msg ="E109: Missing ':' after '?': %.*s" , 3185} , 3186} , { 3187hl ( 'IdentifierName' , 'a' ), 3188hl ( 'Ternary' , '?' ), 3189hl ( 'IdentifierName' , 'b' ), 3190} ) 3191check_parsing ( 'a?b:' , { 3192-- 0123 3193ast ={ 3194{ 3195'Ternary:0:1:?' , 3196children ={ 3197'PlainIdentifier(scope=0,ident=a):0:0:a' , 3198{ 3199'TernaryValue:0:1:?' , 3200children ={ 3201'PlainIdentifier(scope=b,ident=):0:2:b:' , 3202} , 3203} , 3204} , 3205} , 3206} , 3207err ={ 3208arg ='?b:' , 3209msg ="E109: Missing ':' after '?': %.*s" , 3210} , 3211} , { 3212hl ( 'IdentifierName' , 'a' ), 3213hl ( 'Ternary' , '?' ), 3214hl ( 'IdentifierScope' , 'b' ), 3215hl ( 'IdentifierScopeDelimiter' , ':' ), 3216} ) 3217 3218check_parsing ( 'a?b::c' , { 3219-- 012345 3220ast ={ 3221{ 3222'Ternary:0:1:?' , 3223children ={ 3224'PlainIdentifier(scope=0,ident=a):0:0:a' , 3225{ 3226'TernaryValue:0:4::' , 3227children ={ 3228'PlainIdentifier(scope=b,ident=):0:2:b:' , 3229'PlainIdentifier(scope=0,ident=c):0:5:c' , 3230} , 3231} , 3232} , 3233} , 3234} , 3235} , { 3236hl ( 'IdentifierName' , 'a' ), 3237hl ( 'Ternary' , '?' ), 3238hl ( 'IdentifierScope' , 'b' ), 3239hl ( 'IdentifierScopeDelimiter' , ':' ), 3240hl ( 'TernaryColon' , ':' ), 3241hl ( 'IdentifierName' , 'c' ), 3242} ) 3243 3244check_parsing ( 'a?b :' , { 3245-- 01234 3246ast ={ 3247{ 3248'Ternary:0:1:?' , 3249children ={ 3250'PlainIdentifier(scope=0,ident=a):0:0:a' , 3251{ 3252'TernaryValue:0:3: :' , 3253children ={ 3254'PlainIdentifier(scope=0,ident=b):0:2:b' , 3255} , 3256} , 3257} , 3258} , 3259} , 3260err ={ 3261arg ='' , 3262msg ='E15: Expected value, got EOC: %.*s' , 3263} , 3264} , { 3265hl ( 'IdentifierName' , 'a' ), 3266hl ( 'Ternary' , '?' ), 3267hl ( 'IdentifierName' , 'b' ), 3268hl ( 'TernaryColon' , ':' , 1 ), 3269} ) 3270 3271check_parsing ( '(@a?@b:@c)?@d:@e' , { 3272-- 0123456789012345 3273-- 0 1 3274ast ={ 3275{ 3276'Ternary:0:10:?' , 3277children ={ 3278{ 3279'Nested:0:0:(' , 3280children ={ 3281{ 3282'Ternary:0:3:?' , 3283children ={ 3284'Register(name=a):0:1:@a' , 3285{ 3286'TernaryValue:0:6::' , 3287children ={ 3288'Register(name=b):0:4:@b' , 3289'Register(name=c):0:7:@c' , 3290} , 3291} , 3292} , 3293} , 3294} , 3295} , 3296{ 3297'TernaryValue:0:13::' , 3298children ={ 3299'Register(name=d):0:11:@d' , 3300'Register(name=e):0:14:@e' , 3301} , 3302} , 3303} , 3304} , 3305} , 3306} , { 3307hl ( 'NestingParenthesis' , '(' ), 3308hl ( 'Register' , '@a' ), 3309hl ( 'Ternary' , '?' ), 3310hl ( 'Register' , '@b' ), 3311hl ( 'TernaryColon' , ':' ), 3312hl ( 'Register' , '@c' ), 3313hl ( 'NestingParenthesis' , ')' ), 3314hl ( 'Ternary' , '?' ), 3315hl ( 'Register' , '@d' ), 3316hl ( 'TernaryColon' , ':' ), 3317hl ( 'Register' , '@e' ), 3318} ) 3319 3320check_parsing ( '(@a?@b:@c)?(@d?@e:@f):(@g?@h:@i)' , { 3321-- 01234567890123456789012345678901 3322-- 0 1 2 3 3323ast ={ 3324{ 3325'Ternary:0:10:?' , 3326children ={ 3327{ 3328'Nested:0:0:(' , 3329children ={ 3330{ 3331'Ternary:0:3:?' , 3332children ={ 3333'Register(name=a):0:1:@a' , 3334{ 3335'TernaryValue:0:6::' , 3336children ={ 3337'Register(name=b):0:4:@b' , 3338'Register(name=c):0:7:@c' , 3339} , 3340} , 3341} , 3342} , 3343} , 3344} , 3345{ 3346'TernaryValue:0:21::' , 3347children ={ 3348{ 3349'Nested:0:11:(' , 3350children ={ 3351{ 3352'Ternary:0:14:?' , 3353children ={ 3354'Register(name=d):0:12:@d' , 3355{ 3356'TernaryValue:0:17::' , 3357children ={ 3358'Register(name=e):0:15:@e' , 3359'Register(name=f):0:18:@f' , 3360} , 3361} , 3362} , 3363} , 3364} , 3365} , 3366{ 3367'Nested:0:22:(' , 3368children ={ 3369{ 3370'Ternary:0:25:?' , 3371children ={ 3372'Register(name=g):0:23:@g' , 3373{ 3374'TernaryValue:0:28::' , 3375children ={ 3376'Register(name=h):0:26:@h' , 3377'Register(name=i):0:29:@i' , 3378} , 3379} , 3380} , 3381} , 3382} , 3383} , 3384} , 3385} , 3386} , 3387} , 3388} , 3389} , { 3390hl ( 'NestingParenthesis' , '(' ), 3391hl ( 'Register' , '@a' ), 3392hl ( 'Ternary' , '?' ), 3393hl ( 'Register' , '@b' ), 3394hl ( 'TernaryColon' , ':' ), 3395hl ( 'Register' , '@c' ), 3396hl ( 'NestingParenthesis' , ')' ), 3397hl ( 'Ternary' , '?' ), 3398hl ( 'NestingParenthesis' , '(' ), 3399hl ( 'Register' , '@d' ), 3400hl ( 'Ternary' , '?' ), 3401hl ( 'Register' , '@e' ), 3402hl ( 'TernaryColon' , ':' ), 3403hl ( 'Register' , '@f' ), 3404hl ( 'NestingParenthesis' , ')' ), 3405hl ( 'TernaryColon' , ':' ), 3406hl ( 'NestingParenthesis' , '(' ), 3407hl ( 'Register' , '@g' ), 3408hl ( 'Ternary' , '?' ), 3409hl ( 'Register' , '@h' ), 3410hl ( 'TernaryColon' , ':' ), 3411hl ( 'Register' , '@i' ), 3412hl ( 'NestingParenthesis' , ')' ), 3413} ) 3414 3415check_parsing ( '(@a?@b:@c)?@d?@e:@f:@g?@h:@i' , { 3416-- 0123456789012345678901234567 3417-- 0 1 2 3418ast ={ 3419{ 3420'Ternary:0:10:?' , 3421children ={ 3422{ 3423'Nested:0:0:(' , 3424children ={ 3425{ 3426'Ternary:0:3:?' , 3427children ={ 3428'Register(name=a):0:1:@a' , 3429{ 3430'TernaryValue:0:6::' , 3431children ={ 3432'Register(name=b):0:4:@b' , 3433'Register(name=c):0:7:@c' , 3434} , 3435} , 3436} , 3437} , 3438} , 3439} , 3440{ 3441'TernaryValue:0:19::' , 3442children ={ 3443{ 3444'Ternary:0:13:?' , 3445children ={ 3446'Register(name=d):0:11:@d' , 3447{ 3448'TernaryValue:0:16::' , 3449children ={ 3450'Register(name=e):0:14:@e' , 3451'Register(name=f):0:17:@f' , 3452} , 3453} , 3454} , 3455} , 3456{ 3457'Ternary:0:22:?' , 3458children ={ 3459'Register(name=g):0:20:@g' , 3460{ 3461'TernaryValue:0:25::' , 3462children ={ 3463'Register(name=h):0:23:@h' , 3464'Register(name=i):0:26:@i' , 3465} , 3466} , 3467} , 3468} , 3469} , 3470} , 3471} , 3472} , 3473} , 3474} , { 3475hl ( 'NestingParenthesis' , '(' ), 3476hl ( 'Register' , '@a' ), 3477hl ( 'Ternary' , '?' ), 3478hl ( 'Register' , '@b' ), 3479hl ( 'TernaryColon' , ':' ), 3480hl ( 'Register' , '@c' ), 3481hl ( 'NestingParenthesis' , ')' ), 3482hl ( 'Ternary' , '?' ), 3483hl ( 'Register' , '@d' ), 3484hl ( 'Ternary' , '?' ), 3485hl ( 'Register' , '@e' ), 3486hl ( 'TernaryColon' , ':' ), 3487hl ( 'Register' , '@f' ), 3488hl ( 'TernaryColon' , ':' ), 3489hl ( 'Register' , '@g' ), 3490hl ( 'Ternary' , '?' ), 3491hl ( 'Register' , '@h' ), 3492hl ( 'TernaryColon' , ':' ), 3493hl ( 'Register' , '@i' ), 3494} ) 3495check_parsing ( 'a?b{cdef}g:h' , { 3496-- 012345678901 3497-- 0 1 3498ast ={ 3499{ 3500'Ternary:0:1:?' , 3501children ={ 3502'PlainIdentifier(scope=0,ident=a):0:0:a' , 3503{ 3504'TernaryValue:0:10::' , 3505children ={ 3506{ 3507'ComplexIdentifier:0:3:' , 3508children ={ 3509'PlainIdentifier(scope=0,ident=b):0:2:b' , 3510{ 3511'ComplexIdentifier:0:9:' , 3512children ={ 3513{ 3514fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:3:{' ), 3515children ={ 3516'PlainIdentifier(scope=0,ident=cdef):0:4:cdef' , 3517} , 3518} , 3519'PlainIdentifier(scope=0,ident=g):0:9:g' , 3520} , 3521} , 3522} , 3523} , 3524'PlainIdentifier(scope=0,ident=h):0:11:h' , 3525} , 3526} , 3527} , 3528} , 3529} , 3530} , { 3531hl ( 'IdentifierName' , 'a' ), 3532hl ( 'Ternary' , '?' ), 3533hl ( 'IdentifierName' , 'b' ), 3534hl ( 'Curly' , '{' ), 3535hl ( 'IdentifierName' , 'cdef' ), 3536hl ( 'Curly' , '}' ), 3537hl ( 'IdentifierName' , 'g' ), 3538hl ( 'TernaryColon' , ':' ), 3539hl ( 'IdentifierName' , 'h' ), 3540} ) 3541check_parsing ( 'a ? b : c : d' , { 3542-- 0123456789012 3543-- 0 1 3544ast ={ 3545{ 3546'Colon:0:9: :' , 3547children ={ 3548{ 3549'Ternary:0:1: ?' , 3550children ={ 3551'PlainIdentifier(scope=0,ident=a):0:0:a' , 3552{ 3553'TernaryValue:0:5: :' , 3554children ={ 3555'PlainIdentifier(scope=0,ident=b):0:3: b' , 3556'PlainIdentifier(scope=0,ident=c):0:7: c' , 3557} , 3558} , 3559} , 3560} , 3561'PlainIdentifier(scope=0,ident=d):0:11: d' , 3562} , 3563} , 3564} , 3565err ={ 3566arg =': d' , 3567msg ='E15: Colon outside of dictionary or ternary operator: %.*s' , 3568} , 3569} , { 3570hl ( 'IdentifierName' , 'a' ), 3571hl ( 'Ternary' , '?' , 1 ), 3572hl ( 'IdentifierName' , 'b' , 1 ), 3573hl ( 'TernaryColon' , ':' , 1 ), 3574hl ( 'IdentifierName' , 'c' , 1 ), 3575hl ( 'InvalidColon' , ':' , 1 ), 3576hl ( 'IdentifierName' , 'd' , 1 ), 3577} ) 3578end ) 3579itp ( 'works with comparison operators' , function () 3580check_parsing ( 'a == b' , { 3581-- 012345 3582ast ={ 3583{ 3584'Comparison(type=Equal,inv=0,ccs=UseOption):0:1: ==' , 3585children ={ 3586'PlainIdentifier(scope=0,ident=a):0:0:a' , 3587'PlainIdentifier(scope=0,ident=b):0:4: b' , 3588} , 3589} , 3590} , 3591} , { 3592hl ( 'IdentifierName' , 'a' ), 3593hl ( 'Comparison' , '==' , 1 ), 3594hl ( 'IdentifierName' , 'b' , 1 ), 3595} ) 3596 3597check_parsing ( 'a ==? b' , { 3598-- 0123456 3599ast ={ 3600{ 3601'Comparison(type=Equal,inv=0,ccs=IgnoreCase):0:1: ==?' , 3602children ={ 3603'PlainIdentifier(scope=0,ident=a):0:0:a' , 3604'PlainIdentifier(scope=0,ident=b):0:5: b' , 3605} , 3606} , 3607} , 3608} , { 3609hl ( 'IdentifierName' , 'a' ), 3610hl ( 'Comparison' , '==' , 1 ), 3611hl ( 'ComparisonModifier' , '?' ), 3612hl ( 'IdentifierName' , 'b' , 1 ), 3613} ) 3614 3615check_parsing ( 'a ==# b' , { 3616-- 0123456 3617ast ={ 3618{ 3619'Comparison(type=Equal,inv=0,ccs=MatchCase):0:1: ==#' , 3620children ={ 3621'PlainIdentifier(scope=0,ident=a):0:0:a' , 3622'PlainIdentifier(scope=0,ident=b):0:5: b' , 3623} , 3624} , 3625} , 3626} , { 3627hl ( 'IdentifierName' , 'a' ), 3628hl ( 'Comparison' , '==' , 1 ), 3629hl ( 'ComparisonModifier' , '#' ), 3630hl ( 'IdentifierName' , 'b' , 1 ), 3631} ) 3632 3633check_parsing ( 'a !=# b' , { 3634-- 0123456 3635ast ={ 3636{ 3637'Comparison(type=Equal,inv=1,ccs=MatchCase):0:1: !=#' , 3638children ={ 3639'PlainIdentifier(scope=0,ident=a):0:0:a' , 3640'PlainIdentifier(scope=0,ident=b):0:5: b' , 3641} , 3642} , 3643} , 3644} , { 3645hl ( 'IdentifierName' , 'a' ), 3646hl ( 'Comparison' , '!=' , 1 ), 3647hl ( 'ComparisonModifier' , '#' ), 3648hl ( 'IdentifierName' , 'b' , 1 ), 3649} ) 3650 3651check_parsing ( 'a <=# b' , { 3652-- 0123456 3653ast ={ 3654{ 3655'Comparison(type=Greater,inv=1,ccs=MatchCase):0:1: <=#' , 3656children ={ 3657'PlainIdentifier(scope=0,ident=a):0:0:a' , 3658'PlainIdentifier(scope=0,ident=b):0:5: b' , 3659} , 3660} , 3661} , 3662} , { 3663hl ( 'IdentifierName' , 'a' ), 3664hl ( 'Comparison' , '<=' , 1 ), 3665hl ( 'ComparisonModifier' , '#' ), 3666hl ( 'IdentifierName' , 'b' , 1 ), 3667} ) 3668 3669check_parsing ( 'a >=# b' , { 3670-- 0123456 3671ast ={ 3672{ 3673'Comparison(type=GreaterOrEqual,inv=0,ccs=MatchCase):0:1: >=#' , 3674children ={ 3675'PlainIdentifier(scope=0,ident=a):0:0:a' , 3676'PlainIdentifier(scope=0,ident=b):0:5: b' , 3677} , 3678} , 3679} , 3680} , { 3681hl ( 'IdentifierName' , 'a' ), 3682hl ( 'Comparison' , '>=' , 1 ), 3683hl ( 'ComparisonModifier' , '#' ), 3684hl ( 'IdentifierName' , 'b' , 1 ), 3685} ) 3686 3687check_parsing ( 'a ># b' , { 3688-- 012345 3689ast ={ 3690{ 3691'Comparison(type=Greater,inv=0,ccs=MatchCase):0:1: >#' , 3692children ={ 3693'PlainIdentifier(scope=0,ident=a):0:0:a' , 3694'PlainIdentifier(scope=0,ident=b):0:4: b' , 3695} , 3696} , 3697} , 3698} , { 3699hl ( 'IdentifierName' , 'a' ), 3700hl ( 'Comparison' , '>' , 1 ), 3701hl ( 'ComparisonModifier' , '#' ), 3702hl ( 'IdentifierName' , 'b' , 1 ), 3703} ) 3704 3705check_parsing ( 'a <# b' , { 3706-- 012345 3707ast ={ 3708{ 3709'Comparison(type=GreaterOrEqual,inv=1,ccs=MatchCase):0:1: <#' , 3710children ={ 3711'PlainIdentifier(scope=0,ident=a):0:0:a' , 3712'PlainIdentifier(scope=0,ident=b):0:4: b' , 3713} , 3714} , 3715} , 3716} , { 3717hl ( 'IdentifierName' , 'a' ), 3718hl ( 'Comparison' , '<' , 1 ), 3719hl ( 'ComparisonModifier' , '#' ), 3720hl ( 'IdentifierName' , 'b' , 1 ), 3721} ) 3722 3723check_parsing ( 'a is#b' , { 3724-- 012345 3725ast ={ 3726{ 3727'Comparison(type=Identical,inv=0,ccs=MatchCase):0:1: is#' , 3728children ={ 3729'PlainIdentifier(scope=0,ident=a):0:0:a' , 3730'PlainIdentifier(scope=0,ident=b):0:5:b' , 3731} , 3732} , 3733} , 3734} , { 3735hl ( 'IdentifierName' , 'a' ), 3736hl ( 'Comparison' , 'is' , 1 ), 3737hl ( 'ComparisonModifier' , '#' ), 3738hl ( 'IdentifierName' , 'b' ), 3739} ) 3740 3741check_parsing ( 'a is?b' , { 3742-- 012345 3743ast ={ 3744{ 3745'Comparison(type=Identical,inv=0,ccs=IgnoreCase):0:1: is?' , 3746children ={ 3747'PlainIdentifier(scope=0,ident=a):0:0:a' , 3748'PlainIdentifier(scope=0,ident=b):0:5:b' , 3749} , 3750} , 3751} , 3752} , { 3753hl ( 'IdentifierName' , 'a' ), 3754hl ( 'Comparison' , 'is' , 1 ), 3755hl ( 'ComparisonModifier' , '?' ), 3756hl ( 'IdentifierName' , 'b' ), 3757} ) 3758 3759check_parsing ( 'a isnot b' , { 3760-- 012345678 3761ast ={ 3762{ 3763'Comparison(type=Identical,inv=1,ccs=UseOption):0:1: isnot' , 3764children ={ 3765'PlainIdentifier(scope=0,ident=a):0:0:a' , 3766'PlainIdentifier(scope=0,ident=b):0:7: b' , 3767} , 3768} , 3769} , 3770} , { 3771hl ( 'IdentifierName' , 'a' ), 3772hl ( 'Comparison' , 'isnot' , 1 ), 3773hl ( 'IdentifierName' , 'b' , 1 ), 3774} ) 3775 3776check_parsing ( 'a < b < c' , { 3777-- 012345678 3778ast ={ 3779{ 3780'Comparison(type=GreaterOrEqual,inv=1,ccs=UseOption):0:1: <' , 3781children ={ 3782'PlainIdentifier(scope=0,ident=a):0:0:a' , 3783{ 3784'Comparison(type=GreaterOrEqual,inv=1,ccs=UseOption):0:5: <' , 3785children ={ 3786'PlainIdentifier(scope=0,ident=b):0:3: b' , 3787'PlainIdentifier(scope=0,ident=c):0:7: c' , 3788} , 3789} , 3790} , 3791} , 3792} , 3793err ={ 3794arg =' < c' , 3795msg ='E15: Operator is not associative: %.*s' , 3796} , 3797} , { 3798hl ( 'IdentifierName' , 'a' ), 3799hl ( 'Comparison' , '<' , 1 ), 3800hl ( 'IdentifierName' , 'b' , 1 ), 3801hl ( 'InvalidComparison' , '<' , 1 ), 3802hl ( 'IdentifierName' , 'c' , 1 ), 3803} ) 3804 3805check_parsing ( 'a < b <# c' , { 3806-- 012345678 3807ast ={ 3808{ 3809'Comparison(type=GreaterOrEqual,inv=1,ccs=UseOption):0:1: <' , 3810children ={ 3811'PlainIdentifier(scope=0,ident=a):0:0:a' , 3812{ 3813'Comparison(type=GreaterOrEqual,inv=1,ccs=MatchCase):0:5: <#' , 3814children ={ 3815'PlainIdentifier(scope=0,ident=b):0:3: b' , 3816'PlainIdentifier(scope=0,ident=c):0:8: c' , 3817} , 3818} , 3819} , 3820} , 3821} , 3822err ={ 3823arg =' <# c' , 3824msg ='E15: Operator is not associative: %.*s' , 3825} , 3826} , { 3827hl ( 'IdentifierName' , 'a' ), 3828hl ( 'Comparison' , '<' , 1 ), 3829hl ( 'IdentifierName' , 'b' , 1 ), 3830hl ( 'InvalidComparison' , '<' , 1 ), 3831hl ( 'InvalidComparisonModifier' , '#' ), 3832hl ( 'IdentifierName' , 'c' , 1 ), 3833} ) 3834 3835check_parsing ( 'a += b' , { 3836-- 012345 3837ast ={ 3838{ 3839'Assignment(Add):0:1: +=' , 3840children ={ 3841'PlainIdentifier(scope=0,ident=a):0:0:a' , 3842'PlainIdentifier(scope=0,ident=b):0:4: b' , 3843} , 3844} , 3845} , 3846err ={ 3847arg ='+= b' , 3848msg ='E15: Misplaced assignment: %.*s' , 3849} , 3850} , { 3851hl ( 'IdentifierName' , 'a' ), 3852hl ( 'InvalidAssignmentWithAddition' , '+=' , 1 ), 3853hl ( 'IdentifierName' , 'b' , 1 ), 3854} ) 3855check_parsing ( 'a + b == c + d' , { 3856-- 01234567890123 3857-- 0 1 3858ast ={ 3859{ 3860'Comparison(type=Equal,inv=0,ccs=UseOption):0:5: ==' , 3861children ={ 3862{ 3863'BinaryPlus:0:1: +' , 3864children ={ 3865'PlainIdentifier(scope=0,ident=a):0:0:a' , 3866'PlainIdentifier(scope=0,ident=b):0:3: b' , 3867} , 3868} , 3869{ 3870'BinaryPlus:0:10: +' , 3871children ={ 3872'PlainIdentifier(scope=0,ident=c):0:8: c' , 3873'PlainIdentifier(scope=0,ident=d):0:12: d' , 3874} , 3875} , 3876} , 3877} , 3878} , 3879} , { 3880hl ( 'IdentifierName' , 'a' ), 3881hl ( 'BinaryPlus' , '+' , 1 ), 3882hl ( 'IdentifierName' , 'b' , 1 ), 3883hl ( 'Comparison' , '==' , 1 ), 3884hl ( 'IdentifierName' , 'c' , 1 ), 3885hl ( 'BinaryPlus' , '+' , 1 ), 3886hl ( 'IdentifierName' , 'd' , 1 ), 3887} ) 3888check_parsing ( '+ a == + b' , { 3889-- 0123456789 3890ast ={ 3891{ 3892'Comparison(type=Equal,inv=0,ccs=UseOption):0:3: ==' , 3893children ={ 3894{ 3895'UnaryPlus:0:0:+' , 3896children ={ 3897'PlainIdentifier(scope=0,ident=a):0:1: a' , 3898} , 3899} , 3900{ 3901'UnaryPlus:0:6: +' , 3902children ={ 3903'PlainIdentifier(scope=0,ident=b):0:8: b' , 3904} , 3905} , 3906} , 3907} , 3908} , 3909} , { 3910hl ( 'UnaryPlus' , '+' ), 3911hl ( 'IdentifierName' , 'a' , 1 ), 3912hl ( 'Comparison' , '==' , 1 ), 3913hl ( 'UnaryPlus' , '+' , 1 ), 3914hl ( 'IdentifierName' , 'b' , 1 ), 3915} ) 3916end ) 3917itp ( 'works with concat/subscript' , function () 3918check_parsing ( '.' , { 3919-- 0 3920ast ={ 3921{ 3922'ConcatOrSubscript:0:0:.' , 3923children ={ 3924'Missing:0:0:' , 3925} , 3926} , 3927} , 3928err ={ 3929arg ='.' , 3930msg ='E15: Unexpected dot: %.*s' , 3931} , 3932} , { 3933hl ( 'InvalidConcatOrSubscript' , '.' ), 3934} ) 3935 3936check_parsing ( 'a.' , { 3937-- 01 3938ast ={ 3939{ 3940'ConcatOrSubscript:0:1:.' , 3941children ={ 3942'PlainIdentifier(scope=0,ident=a):0:0:a' , 3943} , 3944} , 3945} , 3946err ={ 3947arg ='' , 3948msg ='E15: Expected value, got EOC: %.*s' , 3949} , 3950} , { 3951hl ( 'IdentifierName' , 'a' ), 3952hl ( 'ConcatOrSubscript' , '.' ), 3953} ) 3954 3955check_parsing ( 'a.b' , { 3956-- 012 3957ast ={ 3958{ 3959'ConcatOrSubscript:0:1:.' , 3960children ={ 3961'PlainIdentifier(scope=0,ident=a):0:0:a' , 3962'PlainKey(key=b):0:2:b' , 3963} , 3964} , 3965} , 3966} , { 3967hl ( 'IdentifierName' , 'a' ), 3968hl ( 'ConcatOrSubscript' , '.' ), 3969hl ( 'IdentifierKey' , 'b' ), 3970} ) 3971 3972check_parsing ( '1.2' , { 3973-- 012 3974ast ={ 3975'Float(val=1.200000e+00):0:0:1.2' , 3976} , 3977} , { 3978hl ( 'Float' , '1.2' ), 3979} ) 3980 3981check_parsing ( '1.2 + 1.3e-5' , { 3982-- 012345678901 3983-- 0 1 3984ast ={ 3985{ 3986'BinaryPlus:0:3: +' , 3987children ={ 3988'Float(val=1.200000e+00):0:0:1.2' , 3989'Float(val=1.300000e-05):0:5: 1.3e-5' , 3990} , 3991} , 3992} , 3993} , { 3994hl ( 'Float' , '1.2' ), 3995hl ( 'BinaryPlus' , '+' , 1 ), 3996hl ( 'Float' , '1.3e-5' , 1 ), 3997} ) 3998 3999check_parsing ( 'a . 1.2 + 1.3e-5' , { 4000-- 0123456789012345 4001-- 0 1 4002ast ={ 4003{ 4004'BinaryPlus:0:7: +' , 4005children ={ 4006{ 4007'Concat:0:1: .' , 4008children ={ 4009'PlainIdentifier(scope=0,ident=a):0:0:a' , 4010{ 4011'ConcatOrSubscript:0:5:.' , 4012children ={ 4013'Integer(val=1):0:3: 1' , 4014'PlainKey(key=2):0:6:2' , 4015} , 4016} , 4017} , 4018} , 4019'Float(val=1.300000e-05):0:9: 1.3e-5' , 4020} , 4021} , 4022} , 4023} , { 4024hl ( 'IdentifierName' , 'a' ), 4025hl ( 'Concat' , '.' , 1 ), 4026hl ( 'Number' , '1' , 1 ), 4027hl ( 'ConcatOrSubscript' , '.' ), 4028hl ( 'IdentifierKey' , '2' ), 4029hl ( 'BinaryPlus' , '+' , 1 ), 4030hl ( 'Float' , '1.3e-5' , 1 ), 4031} ) 4032 4033check_parsing ( '1.3e-5 + 1.2 . a' , { 4034-- 0123456789012345 4035-- 0 1 4036ast ={ 4037{ 4038'Concat:0:12: .' , 4039children ={ 4040{ 4041'BinaryPlus:0:6: +' , 4042children ={ 4043'Float(val=1.300000e-05):0:0:1.3e-5' , 4044'Float(val=1.200000e+00):0:8: 1.2' , 4045} , 4046} , 4047'PlainIdentifier(scope=0,ident=a):0:14: a' , 4048} , 4049} , 4050} , 4051} , { 4052hl ( 'Float' , '1.3e-5' ), 4053hl ( 'BinaryPlus' , '+' , 1 ), 4054hl ( 'Float' , '1.2' , 1 ), 4055hl ( 'Concat' , '.' , 1 ), 4056hl ( 'IdentifierName' , 'a' , 1 ), 4057} ) 4058 4059check_parsing ( '1.3e-5 + a . 1.2' , { 4060-- 0123456789012345 4061-- 0 1 4062ast ={ 4063{ 4064'Concat:0:10: .' , 4065children ={ 4066{ 4067'BinaryPlus:0:6: +' , 4068children ={ 4069'Float(val=1.300000e-05):0:0:1.3e-5' , 4070'PlainIdentifier(scope=0,ident=a):0:8: a' , 4071} , 4072} , 4073{ 4074'ConcatOrSubscript:0:14:.' , 4075children ={ 4076'Integer(val=1):0:12: 1' , 4077'PlainKey(key=2):0:15:2' , 4078} , 4079} , 4080} , 4081} , 4082} , 4083} , { 4084hl ( 'Float' , '1.3e-5' ), 4085hl ( 'BinaryPlus' , '+' , 1 ), 4086hl ( 'IdentifierName' , 'a' , 1 ), 4087hl ( 'Concat' , '.' , 1 ), 4088hl ( 'Number' , '1' , 1 ), 4089hl ( 'ConcatOrSubscript' , '.' ), 4090hl ( 'IdentifierKey' , '2' ), 4091} ) 4092 4093check_parsing ( '1.2.3' , { 4094-- 01234 4095ast ={ 4096{ 4097'ConcatOrSubscript:0:3:.' , 4098children ={ 4099{ 4100'ConcatOrSubscript:0:1:.' , 4101children ={ 4102'Integer(val=1):0:0:1' , 4103'PlainKey(key=2):0:2:2' , 4104} , 4105} , 4106'PlainKey(key=3):0:4:3' , 4107} , 4108} , 4109} , 4110} , { 4111hl ( 'Number' , '1' ), 4112hl ( 'ConcatOrSubscript' , '.' ), 4113hl ( 'IdentifierKey' , '2' ), 4114hl ( 'ConcatOrSubscript' , '.' ), 4115hl ( 'IdentifierKey' , '3' ), 4116} ) 4117 4118check_parsing ( 'a.1.2' , { 4119-- 01234 4120ast ={ 4121{ 4122'ConcatOrSubscript:0:3:.' , 4123children ={ 4124{ 4125'ConcatOrSubscript:0:1:.' , 4126children ={ 4127'PlainIdentifier(scope=0,ident=a):0:0:a' , 4128'PlainKey(key=1):0:2:1' , 4129} , 4130} , 4131'PlainKey(key=2):0:4:2' , 4132} , 4133} , 4134} , 4135} , { 4136hl ( 'IdentifierName' , 'a' ), 4137hl ( 'ConcatOrSubscript' , '.' ), 4138hl ( 'IdentifierKey' , '1' ), 4139hl ( 'ConcatOrSubscript' , '.' ), 4140hl ( 'IdentifierKey' , '2' ), 4141} ) 4142 4143check_parsing ( 'a . 1.2' , { 4144-- 0123456 4145ast ={ 4146{ 4147'Concat:0:1: .' , 4148children ={ 4149'PlainIdentifier(scope=0,ident=a):0:0:a' , 4150{ 4151'ConcatOrSubscript:0:5:.' , 4152children ={ 4153'Integer(val=1):0:3: 1' , 4154'PlainKey(key=2):0:6:2' , 4155} , 4156} , 4157} , 4158} , 4159} , 4160} , { 4161hl ( 'IdentifierName' , 'a' ), 4162hl ( 'Concat' , '.' , 1 ), 4163hl ( 'Number' , '1' , 1 ), 4164hl ( 'ConcatOrSubscript' , '.' ), 4165hl ( 'IdentifierKey' , '2' ), 4166} ) 4167 4168check_parsing ( '+a . +b' , { 4169-- 0123456 4170ast ={ 4171{ 4172'Concat:0:2: .' , 4173children ={ 4174{ 4175'UnaryPlus:0:0:+' , 4176children ={ 4177'PlainIdentifier(scope=0,ident=a):0:1:a' , 4178} , 4179} , 4180{ 4181'UnaryPlus:0:4: +' , 4182children ={ 4183'PlainIdentifier(scope=0,ident=b):0:6:b' , 4184} , 4185} , 4186} , 4187} , 4188} , 4189} , { 4190hl ( 'UnaryPlus' , '+' ), 4191hl ( 'IdentifierName' , 'a' ), 4192hl ( 'Concat' , '.' , 1 ), 4193hl ( 'UnaryPlus' , '+' , 1 ), 4194hl ( 'IdentifierName' , 'b' ), 4195} ) 4196 4197check_parsing ( 'a. b' , { 4198-- 0123 4199ast ={ 4200{ 4201'Concat:0:1:.' , 4202children ={ 4203'PlainIdentifier(scope=0,ident=a):0:0:a' , 4204'PlainIdentifier(scope=0,ident=b):0:2: b' , 4205} , 4206} , 4207} , 4208} , { 4209hl ( 'IdentifierName' , 'a' ), 4210hl ( 'ConcatOrSubscript' , '.' ), 4211hl ( 'IdentifierName' , 'b' , 1 ), 4212} ) 4213 4214check_parsing ( 'a. 1' , { 4215-- 0123 4216ast ={ 4217{ 4218'Concat:0:1:.' , 4219children ={ 4220'PlainIdentifier(scope=0,ident=a):0:0:a' , 4221'Integer(val=1):0:2: 1' , 4222} , 4223} , 4224} , 4225} , { 4226hl ( 'IdentifierName' , 'a' ), 4227hl ( 'ConcatOrSubscript' , '.' ), 4228hl ( 'Number' , '1' , 1 ), 4229} ) 4230 4231check_parsing ( 'a[1][2][3[4' , { 4232-- 01234567890 4233-- 0 1 4234ast ={ 4235{ 4236'Subscript:0:7:[' , 4237children ={ 4238{ 4239'Subscript:0:4:[' , 4240children ={ 4241{ 4242'Subscript:0:1:[' , 4243children ={ 4244'PlainIdentifier(scope=0,ident=a):0:0:a' , 4245'Integer(val=1):0:2:1' , 4246} , 4247} , 4248'Integer(val=2):0:5:2' , 4249} , 4250} , 4251{ 4252'Subscript:0:9:[' , 4253children ={ 4254'Integer(val=3):0:8:3' , 4255'Integer(val=4):0:10:4' , 4256} , 4257} , 4258} , 4259} , 4260} , 4261} , { 4262hl ( 'IdentifierName' , 'a' ), 4263hl ( 'SubscriptBracket' , '[' ), 4264hl ( 'Number' , '1' ), 4265hl ( 'SubscriptBracket' , ']' ), 4266hl ( 'SubscriptBracket' , '[' ), 4267hl ( 'Number' , '2' ), 4268hl ( 'SubscriptBracket' , ']' ), 4269hl ( 'SubscriptBracket' , '[' ), 4270hl ( 'Number' , '3' ), 4271hl ( 'SubscriptBracket' , '[' ), 4272hl ( 'Number' , '4' ), 4273} ) 4274end ) 4275itp ( 'works with bracket subscripts' , function () 4276check_parsing ( ':' , { 4277-- 0 4278ast ={ 4279{ 4280'Colon:0:0::' , 4281children ={ 4282'Missing:0:0:' , 4283} , 4284} , 4285} , 4286err ={ 4287arg =':' , 4288msg ='E15: Colon outside of dictionary or ternary operator: %.*s' , 4289} , 4290} , { 4291hl ( 'InvalidColon' , ':' ), 4292} ) 4293check_parsing ( 'a[]' , { 4294-- 012 4295ast ={ 4296{ 4297'Subscript:0:1:[' , 4298children ={ 4299'PlainIdentifier(scope=0,ident=a):0:0:a' , 4300} , 4301} , 4302} , 4303err ={ 4304arg =']' , 4305msg ='E15: Expected value, got closing bracket: %.*s' , 4306} , 4307} , { 4308hl ( 'IdentifierName' , 'a' ), 4309hl ( 'SubscriptBracket' , '[' ), 4310hl ( 'InvalidSubscriptBracket' , ']' ), 4311} ) 4312check_parsing ( 'a[b:]' , { 4313-- 01234 4314ast ={ 4315{ 4316'Subscript:0:1:[' , 4317children ={ 4318'PlainIdentifier(scope=0,ident=a):0:0:a' , 4319'PlainIdentifier(scope=b,ident=):0:2:b:' , 4320} , 4321} , 4322} , 4323} , { 4324hl ( 'IdentifierName' , 'a' ), 4325hl ( 'SubscriptBracket' , '[' ), 4326hl ( 'IdentifierScope' , 'b' ), 4327hl ( 'IdentifierScopeDelimiter' , ':' ), 4328hl ( 'SubscriptBracket' , ']' ), 4329} ) 4330 4331check_parsing ( 'a[b:c]' , { 4332-- 012345 4333ast ={ 4334{ 4335'Subscript:0:1:[' , 4336children ={ 4337'PlainIdentifier(scope=0,ident=a):0:0:a' , 4338'PlainIdentifier(scope=b,ident=c):0:2:b:c' , 4339} , 4340} , 4341} , 4342} , { 4343hl ( 'IdentifierName' , 'a' ), 4344hl ( 'SubscriptBracket' , '[' ), 4345hl ( 'IdentifierScope' , 'b' ), 4346hl ( 'IdentifierScopeDelimiter' , ':' ), 4347hl ( 'IdentifierName' , 'c' ), 4348hl ( 'SubscriptBracket' , ']' ), 4349} ) 4350check_parsing ( 'a[b : c]' , { 4351-- 01234567 4352ast ={ 4353{ 4354'Subscript:0:1:[' , 4355children ={ 4356'PlainIdentifier(scope=0,ident=a):0:0:a' , 4357{ 4358'Colon:0:3: :' , 4359children ={ 4360'PlainIdentifier(scope=0,ident=b):0:2:b' , 4361'PlainIdentifier(scope=0,ident=c):0:5: c' , 4362} , 4363} , 4364} , 4365} , 4366} , 4367} , { 4368hl ( 'IdentifierName' , 'a' ), 4369hl ( 'SubscriptBracket' , '[' ), 4370hl ( 'IdentifierName' , 'b' ), 4371hl ( 'SubscriptColon' , ':' , 1 ), 4372hl ( 'IdentifierName' , 'c' , 1 ), 4373hl ( 'SubscriptBracket' , ']' ), 4374} ) 4375 4376check_parsing ( 'a[: b]' , { 4377-- 012345 4378ast ={ 4379{ 4380'Subscript:0:1:[' , 4381children ={ 4382'PlainIdentifier(scope=0,ident=a):0:0:a' , 4383{ 4384'Colon:0:2::' , 4385children ={ 4386'Missing:0:2:' , 4387'PlainIdentifier(scope=0,ident=b):0:3: b' , 4388} , 4389} , 4390} , 4391} , 4392} , 4393} , { 4394hl ( 'IdentifierName' , 'a' ), 4395hl ( 'SubscriptBracket' , '[' ), 4396hl ( 'SubscriptColon' , ':' ), 4397hl ( 'IdentifierName' , 'b' , 1 ), 4398hl ( 'SubscriptBracket' , ']' ), 4399} ) 4400 4401check_parsing ( 'a[b :]' , { 4402-- 012345 4403ast ={ 4404{ 4405'Subscript:0:1:[' , 4406children ={ 4407'PlainIdentifier(scope=0,ident=a):0:0:a' , 4408{ 4409'Colon:0:3: :' , 4410children ={ 4411'PlainIdentifier(scope=0,ident=b):0:2:b' , 4412} , 4413} , 4414} , 4415} , 4416} , 4417} , { 4418hl ( 'IdentifierName' , 'a' ), 4419hl ( 'SubscriptBracket' , '[' ), 4420hl ( 'IdentifierName' , 'b' ), 4421hl ( 'SubscriptColon' , ':' , 1 ), 4422hl ( 'SubscriptBracket' , ']' ), 4423} ) 4424check_parsing ( 'a[b][c][d](e)(f)(g)' , { 4425-- 0123456789012345678 4426-- 0 1 4427ast ={ 4428{ 4429'Call:0:16:(' , 4430children ={ 4431{ 4432'Call:0:13:(' , 4433children ={ 4434{ 4435'Call:0:10:(' , 4436children ={ 4437{ 4438'Subscript:0:7:[' , 4439children ={ 4440{ 4441'Subscript:0:4:[' , 4442children ={ 4443{ 4444'Subscript:0:1:[' , 4445children ={ 4446'PlainIdentifier(scope=0,ident=a):0:0:a' , 4447'PlainIdentifier(scope=0,ident=b):0:2:b' , 4448} , 4449} , 4450'PlainIdentifier(scope=0,ident=c):0:5:c' , 4451} , 4452} , 4453'PlainIdentifier(scope=0,ident=d):0:8:d' , 4454} , 4455} , 4456'PlainIdentifier(scope=0,ident=e):0:11:e' , 4457} , 4458} , 4459'PlainIdentifier(scope=0,ident=f):0:14:f' , 4460} , 4461} , 4462'PlainIdentifier(scope=0,ident=g):0:17:g' , 4463} , 4464} , 4465} , 4466} , { 4467hl ( 'IdentifierName' , 'a' ), 4468hl ( 'SubscriptBracket' , '[' ), 4469hl ( 'IdentifierName' , 'b' ), 4470hl ( 'SubscriptBracket' , ']' ), 4471hl ( 'SubscriptBracket' , '[' ), 4472hl ( 'IdentifierName' , 'c' ), 4473hl ( 'SubscriptBracket' , ']' ), 4474hl ( 'SubscriptBracket' , '[' ), 4475hl ( 'IdentifierName' , 'd' ), 4476hl ( 'SubscriptBracket' , ']' ), 4477hl ( 'CallingParenthesis' , '(' ), 4478hl ( 'IdentifierName' , 'e' ), 4479hl ( 'CallingParenthesis' , ')' ), 4480hl ( 'CallingParenthesis' , '(' ), 4481hl ( 'IdentifierName' , 'f' ), 4482hl ( 'CallingParenthesis' , ')' ), 4483hl ( 'CallingParenthesis' , '(' ), 4484hl ( 'IdentifierName' , 'g' ), 4485hl ( 'CallingParenthesis' , ')' ), 4486} ) 4487check_parsing ( '{a}{b}{c}[d][e][f]' , { 4488-- 012345678901234567 4489-- 0 1 4490ast ={ 4491{ 4492'Subscript:0:15:[' , 4493children ={ 4494{ 4495'Subscript:0:12:[' , 4496children ={ 4497{ 4498'Subscript:0:9:[' , 4499children ={ 4500{ 4501'ComplexIdentifier:0:3:' , 4502children ={ 4503{ 4504fmtn ( 'CurlyBracesIdentifier' , '-di' , ':0:0:{' ), 4505children ={ 4506'PlainIdentifier(scope=0,ident=a):0:1:a' , 4507} , 4508} , 4509{ 4510'ComplexIdentifier:0:6:' , 4511children ={ 4512{ 4513fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:3:{' ), 4514children ={ 4515'PlainIdentifier(scope=0,ident=b):0:4:b' , 4516} , 4517} , 4518{ 4519fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:6:{' ), 4520children ={ 4521'PlainIdentifier(scope=0,ident=c):0:7:c' , 4522} , 4523} , 4524} , 4525} , 4526} , 4527} , 4528'PlainIdentifier(scope=0,ident=d):0:10:d' , 4529} , 4530} , 4531'PlainIdentifier(scope=0,ident=e):0:13:e' , 4532} , 4533} , 4534'PlainIdentifier(scope=0,ident=f):0:16:f' , 4535} , 4536} , 4537} , 4538} , { 4539hl ( 'Curly' , '{' ), 4540hl ( 'IdentifierName' , 'a' ), 4541hl ( 'Curly' , '}' ), 4542hl ( 'Curly' , '{' ), 4543hl ( 'IdentifierName' , 'b' ), 4544hl ( 'Curly' , '}' ), 4545hl ( 'Curly' , '{' ), 4546hl ( 'IdentifierName' , 'c' ), 4547hl ( 'Curly' , '}' ), 4548hl ( 'SubscriptBracket' , '[' ), 4549hl ( 'IdentifierName' , 'd' ), 4550hl ( 'SubscriptBracket' , ']' ), 4551hl ( 'SubscriptBracket' , '[' ), 4552hl ( 'IdentifierName' , 'e' ), 4553hl ( 'SubscriptBracket' , ']' ), 4554hl ( 'SubscriptBracket' , '[' ), 4555hl ( 'IdentifierName' , 'f' ), 4556hl ( 'SubscriptBracket' , ']' ), 4557} ) 4558end ) 4559itp ( 'supports list literals' , function () 4560check_parsing ( '[]' , { 4561-- 01 4562ast ={ 4563'ListLiteral:0:0:[' , 4564} , 4565} , { 4566hl ( 'List' , '[' ), 4567hl ( 'List' , ']' ), 4568} ) 4569 4570check_parsing ( '[a]' , { 4571-- 012 4572ast ={ 4573{ 4574'ListLiteral:0:0:[' , 4575children ={ 4576'PlainIdentifier(scope=0,ident=a):0:1:a' , 4577} , 4578} , 4579} , 4580} , { 4581hl ( 'List' , '[' ), 4582hl ( 'IdentifierName' , 'a' ), 4583hl ( 'List' , ']' ), 4584} ) 4585 4586check_parsing ( '[a, b]' , { 4587-- 012345 4588ast ={ 4589{ 4590'ListLiteral:0:0:[' , 4591children ={ 4592{ 4593'Comma:0:2:,' , 4594children ={ 4595'PlainIdentifier(scope=0,ident=a):0:1:a' , 4596'PlainIdentifier(scope=0,ident=b):0:3: b' , 4597} , 4598} , 4599} , 4600} , 4601} , 4602} , { 4603hl ( 'List' , '[' ), 4604hl ( 'IdentifierName' , 'a' ), 4605hl ( 'Comma' , ',' ), 4606hl ( 'IdentifierName' , 'b' , 1 ), 4607hl ( 'List' , ']' ), 4608} ) 4609 4610check_parsing ( '[a, b, c]' , { 4611-- 012345678 4612ast ={ 4613{ 4614'ListLiteral:0:0:[' , 4615children ={ 4616{ 4617'Comma:0:2:,' , 4618children ={ 4619'PlainIdentifier(scope=0,ident=a):0:1:a' , 4620{ 4621'Comma:0:5:,' , 4622children ={ 4623'PlainIdentifier(scope=0,ident=b):0:3: b' , 4624'PlainIdentifier(scope=0,ident=c):0:6: c' , 4625} , 4626} , 4627} , 4628} , 4629} , 4630} , 4631} , 4632} , { 4633hl ( 'List' , '[' ), 4634hl ( 'IdentifierName' , 'a' ), 4635hl ( 'Comma' , ',' ), 4636hl ( 'IdentifierName' , 'b' , 1 ), 4637hl ( 'Comma' , ',' ), 4638hl ( 'IdentifierName' , 'c' , 1 ), 4639hl ( 'List' , ']' ), 4640} ) 4641 4642check_parsing ( '[a, b, c, ]' , { 4643-- 01234567890 4644-- 0 1 4645ast ={ 4646{ 4647'ListLiteral:0:0:[' , 4648children ={ 4649{ 4650'Comma:0:2:,' , 4651children ={ 4652'PlainIdentifier(scope=0,ident=a):0:1:a' , 4653{ 4654'Comma:0:5:,' , 4655children ={ 4656'PlainIdentifier(scope=0,ident=b):0:3: b' , 4657{ 4658'Comma:0:8:,' , 4659children ={ 4660'PlainIdentifier(scope=0,ident=c):0:6: c' , 4661} , 4662} , 4663} , 4664} , 4665} , 4666} , 4667} , 4668} , 4669} , 4670} , { 4671hl ( 'List' , '[' ), 4672hl ( 'IdentifierName' , 'a' ), 4673hl ( 'Comma' , ',' ), 4674hl ( 'IdentifierName' , 'b' , 1 ), 4675hl ( 'Comma' , ',' ), 4676hl ( 'IdentifierName' , 'c' , 1 ), 4677hl ( 'Comma' , ',' ), 4678hl ( 'List' , ']' , 1 ), 4679} ) 4680 4681check_parsing ( '[a : b, c : d]' , { 4682-- 01234567890123 4683-- 0 1 4684ast ={ 4685{ 4686'ListLiteral:0:0:[' , 4687children ={ 4688{ 4689'Comma:0:6:,' , 4690children ={ 4691{ 4692'Colon:0:2: :' , 4693children ={ 4694'PlainIdentifier(scope=0,ident=a):0:1:a' , 4695'PlainIdentifier(scope=0,ident=b):0:4: b' , 4696} , 4697} , 4698{ 4699'Colon:0:9: :' , 4700children ={ 4701'PlainIdentifier(scope=0,ident=c):0:7: c' , 4702'PlainIdentifier(scope=0,ident=d):0:11: d' , 4703} , 4704} , 4705} , 4706} , 4707} , 4708} , 4709} , 4710err ={ 4711arg =': b, c : d]' , 4712msg ='E15: Colon outside of dictionary or ternary operator: %.*s' , 4713} , 4714} , { 4715hl ( 'List' , '[' ), 4716hl ( 'IdentifierName' , 'a' ), 4717hl ( 'InvalidColon' , ':' , 1 ), 4718hl ( 'IdentifierName' , 'b' , 1 ), 4719hl ( 'Comma' , ',' ), 4720hl ( 'IdentifierName' , 'c' , 1 ), 4721hl ( 'InvalidColon' , ':' , 1 ), 4722hl ( 'IdentifierName' , 'd' , 1 ), 4723hl ( 'List' , ']' ), 4724} ) 4725 4726check_parsing ( ']' , { 4727-- 0 4728ast ={ 4729'ListLiteral:0:0:' , 4730} , 4731err ={ 4732arg =']' , 4733msg ='E15: Unexpected closing figure brace: %.*s' , 4734} , 4735} , { 4736hl ( 'InvalidList' , ']' ), 4737} ) 4738 4739check_parsing ( 'a]' , { 4740-- 01 4741ast ={ 4742{ 4743'ListLiteral:0:1:' , 4744children ={ 4745'PlainIdentifier(scope=0,ident=a):0:0:a' , 4746} , 4747} , 4748} , 4749err ={ 4750arg =']' , 4751msg ='E15: Unexpected closing figure brace: %.*s' , 4752} , 4753} , { 4754hl ( 'IdentifierName' , 'a' ), 4755hl ( 'InvalidList' , ']' ), 4756} ) 4757 4758check_parsing ( ']a' , { 4759-- 01 4760ast ={ 4761{ 4762'OpMissing:0:1:' , 4763children ={ 4764'ListLiteral:0:0:' , 4765'PlainIdentifier(scope=0,ident=a):0:1:a' , 4766} , 4767} , 4768} , 4769err ={ 4770arg =']a' , 4771msg ='E15: Unexpected closing figure brace: %.*s' , 4772} , 4773} , { 4774hl ( 'InvalidList' , ']' ), 4775hl ( 'InvalidIdentifierName' , 'a' ), 4776} , { 4777[ 1 ] ={ 4778ast ={ 4779len =1 , 4780ast ={ 4781'ListLiteral:0:0:' , 4782} , 4783} , 4784hl_fs ={ 4785[ 2 ] =REMOVE_THIS , 4786} , 4787} , 4788} ) 4789 4790check_parsing ( '[] []' , { 4791-- 01234 4792ast ={ 4793{ 4794'OpMissing:0:2:' , 4795children ={ 4796'ListLiteral:0:0:[' , 4797'ListLiteral:0:2: [' , 4798} , 4799} , 4800} , 4801err ={ 4802arg ='[]' , 4803msg ='E15: Missing operator: %.*s' , 4804} , 4805} , { 4806hl ( 'List' , '[' ), 4807hl ( 'List' , ']' ), 4808hl ( 'InvalidSpacing' , ' ' ), 4809hl ( 'List' , '[' ), 4810hl ( 'List' , ']' ), 4811} , { 4812[ 1 ] ={ 4813ast ={ 4814len =3 , 4815err =REMOVE_THIS , 4816ast ={ 4817'ListLiteral:0:0:[' , 4818} , 4819} , 4820hl_fs ={ 4821[ 3 ] =REMOVE_THIS , 4822[ 4 ] =REMOVE_THIS , 4823[ 5 ] =REMOVE_THIS , 4824} , 4825} , 4826} ) 4827 4828check_parsing ( '[][]' , { 4829-- 0123 4830ast ={ 4831{ 4832'Subscript:0:2:[' , 4833children ={ 4834'ListLiteral:0:0:[' , 4835} , 4836} , 4837} , 4838err ={ 4839arg =']' , 4840msg ='E15: Expected value, got closing bracket: %.*s' , 4841} , 4842} , { 4843hl ( 'List' , '[' ), 4844hl ( 'List' , ']' ), 4845hl ( 'SubscriptBracket' , '[' ), 4846hl ( 'InvalidSubscriptBracket' , ']' ), 4847} ) 4848 4849check_parsing ( '[' , { 4850-- 0 4851ast ={ 4852'ListLiteral:0:0:[' , 4853} , 4854err ={ 4855arg ='' , 4856msg ='E15: Expected value, got EOC: %.*s' , 4857} , 4858} , { 4859hl ( 'List' , '[' ), 4860} ) 4861 4862check_parsing ( '[1' , { 4863-- 01 4864ast ={ 4865{ 4866'ListLiteral:0:0:[' , 4867children ={ 4868'Integer(val=1):0:1:1' , 4869} , 4870} , 4871} , 4872err ={ 4873arg ='[1' , 4874msg ="E697: Missing end of List ']': %.*s" , 4875} , 4876} , { 4877hl ( 'List' , '[' ), 4878hl ( 'Number' , '1' ), 4879} ) 4880end ) 4881itp ( 'works with strings' , function () 4882check_parsing ( "'abc'" , { 4883-- 01234 4884ast ={ 4885fmtn ( 'SingleQuotedString' , 'val="abc"' , ":0:0:'abc'" ), 4886} , 4887} , { 4888hl ( 'SingleQuote' , "'" ), 4889hl ( 'SingleQuotedBody' , 'abc' ), 4890hl ( 'SingleQuote' , "'" ), 4891} ) 4892check_parsing ( '"abc"' , { 4893-- 01234 4894ast ={ 4895fmtn ( 'DoubleQuotedString' , 'val="abc"' , ':0:0:"abc"' ), 4896} , 4897} , { 4898hl ( 'DoubleQuote' , '"' ), 4899hl ( 'DoubleQuotedBody' , 'abc' ), 4900hl ( 'DoubleQuote' , '"' ), 4901} ) 4902check_parsing ( "''" , { 4903-- 01 4904ast ={ 4905fmtn ( 'SingleQuotedString' , 'val=NULL' , ":0:0:''" ), 4906} , 4907} , { 4908hl ( 'SingleQuote' , "'" ), 4909hl ( 'SingleQuote' , "'" ), 4910} ) 4911check_parsing ( '""' , { 4912-- 01 4913ast ={ 4914fmtn ( 'DoubleQuotedString' , 'val=NULL' , ':0:0:""' ), 4915} , 4916} , { 4917hl ( 'DoubleQuote' , '"' ), 4918hl ( 'DoubleQuote' , '"' ), 4919} ) 4920check_parsing ( '"' , { 4921-- 0 4922ast ={ 4923fmtn ( 'DoubleQuotedString' , 'val=NULL' , ':0:0:"' ), 4924} , 4925err ={ 4926arg ='"' , 4927msg ='E114: Missing double quote: %.*s' , 4928} , 4929} , { 4930hl ( 'InvalidDoubleQuote' , '"' ), 4931} ) 4932check_parsing ( "'" , { 4933-- 0 4934ast ={ 4935fmtn ( 'SingleQuotedString' , 'val=NULL' , ":0:0:'" ), 4936} , 4937err ={ 4938arg ="'" , 4939msg ='E115: Missing single quote: %.*s' , 4940} , 4941} , { 4942hl ( 'InvalidSingleQuote' , "'" ), 4943} ) 4944check_parsing ( '"a' , { 4945-- 01 4946ast ={ 4947fmtn ( 'DoubleQuotedString' , 'val="a"' , ':0:0:"a' ), 4948} , 4949err ={ 4950arg ='"a' , 4951msg ='E114: Missing double quote: %.*s' , 4952} , 4953} , { 4954hl ( 'InvalidDoubleQuote' , '"' ), 4955hl ( 'InvalidDoubleQuotedBody' , 'a' ), 4956} ) 4957check_parsing ( "'a" , { 4958-- 01 4959ast ={ 4960fmtn ( 'SingleQuotedString' , 'val="a"' , ":0:0:'a" ), 4961} , 4962err ={ 4963arg ="'a" , 4964msg ='E115: Missing single quote: %.*s' , 4965} , 4966} , { 4967hl ( 'InvalidSingleQuote' , "'" ), 4968hl ( 'InvalidSingleQuotedBody' , 'a' ), 4969} ) 4970check_parsing ( "'abc''def'" , { 4971-- 0123456789 4972ast ={ 4973fmtn ( 'SingleQuotedString' , 'val="abc\'def"' , ":0:0:'abc''def'" ), 4974} , 4975} , { 4976hl ( 'SingleQuote' , "'" ), 4977hl ( 'SingleQuotedBody' , 'abc' ), 4978hl ( 'SingleQuotedQuote' , "''" ), 4979hl ( 'SingleQuotedBody' , 'def' ), 4980hl ( 'SingleQuote' , "'" ), 4981} ) 4982check_parsing ( "'abc''" , { 4983-- 012345 4984ast ={ 4985fmtn ( 'SingleQuotedString' , 'val="abc\'"' , ":0:0:'abc''" ), 4986} , 4987err ={ 4988arg ="'abc''" , 4989msg ='E115: Missing single quote: %.*s' , 4990} , 4991} , { 4992hl ( 'InvalidSingleQuote' , "'" ), 4993hl ( 'InvalidSingleQuotedBody' , 'abc' ), 4994hl ( 'InvalidSingleQuotedQuote' , "''" ), 4995} ) 4996check_parsing ( "''''''''" , { 4997-- 01234567 4998ast ={ 4999fmtn ( 'SingleQuotedString' , "val=\"'''\"" , ":0:0:''''''''" ), 5000} , 5001} , { 5002hl ( 'SingleQuote' , "'" ), 5003hl ( 'SingleQuotedQuote' , "''" ), 5004hl ( 'SingleQuotedQuote' , "''" ), 5005hl ( 'SingleQuotedQuote' , "''" ), 5006hl ( 'SingleQuote' , "'" ), 5007} ) 5008check_parsing ( "'''a''''bc'" , { 5009-- 01234567890 5010-- 0 1 5011ast ={ 5012fmtn ( 'SingleQuotedString' , "val=\"'a''bc\"" , ":0:0:'''a''''bc'" ), 5013} , 5014} , { 5015hl ( 'SingleQuote' , "'" ), 5016hl ( 'SingleQuotedQuote' , "''" ), 5017hl ( 'SingleQuotedBody' , 'a' ), 5018hl ( 'SingleQuotedQuote' , "''" ), 5019hl ( 'SingleQuotedQuote' , "''" ), 5020hl ( 'SingleQuotedBody' , 'bc' ), 5021hl ( 'SingleQuote' , "'" ), 5022} ) 5023check_parsing ( '"\\"\\"\\"\\""' , { 5024-- 0123456789 5025ast ={ 5026fmtn ( 'DoubleQuotedString' , 'val="\\"\\"\\"\\""' , ':0:0:"\\"\\"\\"\\""' ), 5027} , 5028} , { 5029hl ( 'DoubleQuote' , '"' ), 5030hl ( 'DoubleQuotedEscape' , '\\"' ), 5031hl ( 'DoubleQuotedEscape' , '\\"' ), 5032hl ( 'DoubleQuotedEscape' , '\\"' ), 5033hl ( 'DoubleQuotedEscape' , '\\"' ), 5034hl ( 'DoubleQuote' , '"' ), 5035} ) 5036check_parsing ( '"abc\\"def\\"ghi\\"jkl\\"mno"' , { 5037-- 0123456789012345678901234 5038-- 0 1 2 5039ast ={ 5040fmtn ( 5041'DoubleQuotedString' , 5042'val="abc\\"def\\"ghi\\"jkl\\"mno"' , 5043':0:0:"abc\\"def\\"ghi\\"jkl\\"mno"' 5044), 5045} , 5046} , { 5047hl ( 'DoubleQuote' , '"' ), 5048hl ( 'DoubleQuotedBody' , 'abc' ), 5049hl ( 'DoubleQuotedEscape' , '\\"' ), 5050hl ( 'DoubleQuotedBody' , 'def' ), 5051hl ( 'DoubleQuotedEscape' , '\\"' ), 5052hl ( 'DoubleQuotedBody' , 'ghi' ), 5053hl ( 'DoubleQuotedEscape' , '\\"' ), 5054hl ( 'DoubleQuotedBody' , 'jkl' ), 5055hl ( 'DoubleQuotedEscape' , '\\"' ), 5056hl ( 'DoubleQuotedBody' , 'mno' ), 5057hl ( 'DoubleQuote' , '"' ), 5058} ) 5059check_parsing ( '"\\b\\e\\f\\r\\t\\\\"' , { 5060-- 0123456789012345 5061-- 0 1 5062ast ={ 5063[[DoubleQuotedString(val="\008\027\012\r\t\\"):0:0:"\b\e\f\r\t\\"]] , 5064} , 5065} , { 5066hl ( 'DoubleQuote' , '"' ), 5067hl ( 'DoubleQuotedEscape' , '\\b' ), 5068hl ( 'DoubleQuotedEscape' , '\\e' ), 5069hl ( 'DoubleQuotedEscape' , '\\f' ), 5070hl ( 'DoubleQuotedEscape' , '\\r' ), 5071hl ( 'DoubleQuotedEscape' , '\\t' ), 5072hl ( 'DoubleQuotedEscape' , '\\\\' ), 5073hl ( 'DoubleQuote' , '"' ), 5074} ) 5075check_parsing ( '"\\n\n"' , { 5076-- 01234 5077ast ={ 5078fmtn ( 'DoubleQuotedString' , 'val="\\n\\n"' , ':0:0:"\\n\n"' ), 5079} , 5080} , { 5081hl ( 'DoubleQuote' , '"' ), 5082hl ( 'DoubleQuotedEscape' , '\\n' ), 5083hl ( 'DoubleQuotedBody' , '\n' ), 5084hl ( 'DoubleQuote' , '"' ), 5085} ) 5086check_parsing ( '"\\x00"' , { 5087-- 012345 5088ast ={ 5089fmtn ( 'DoubleQuotedString' , 'val="\\000"' , ':0:0:"\\x00"' ), 5090} , 5091} , { 5092hl ( 'DoubleQuote' , '"' ), 5093hl ( 'DoubleQuotedEscape' , '\\x00' ), 5094hl ( 'DoubleQuote' , '"' ), 5095} ) 5096check_parsing ( '"\\xFF"' , { 5097-- 012345 5098ast ={ 5099fmtn ( 'DoubleQuotedString' , 'val="\255"' , ':0:0:"\\xFF"' ), 5100} , 5101} , { 5102hl ( 'DoubleQuote' , '"' ), 5103hl ( 'DoubleQuotedEscape' , '\\xFF' ), 5104hl ( 'DoubleQuote' , '"' ), 5105} ) 5106check_parsing ( '"\\xF"' , { 5107-- 012345 5108ast ={ 5109fmtn ( 'DoubleQuotedString' , 'val="\\015"' , ':0:0:"\\xF"' ), 5110} , 5111} , { 5112hl ( 'DoubleQuote' , '"' ), 5113hl ( 'DoubleQuotedEscape' , '\\xF' ), 5114hl ( 'DoubleQuote' , '"' ), 5115} ) 5116check_parsing ( '"\\u00AB"' , { 5117-- 01234567 5118ast ={ 5119fmtn ( 'DoubleQuotedString' , 'val="«"' , ':0:0:"\\u00AB"' ), 5120} , 5121} , { 5122hl ( 'DoubleQuote' , '"' ), 5123hl ( 'DoubleQuotedEscape' , '\\u00AB' ), 5124hl ( 'DoubleQuote' , '"' ), 5125} ) 5126check_parsing ( '"\\U000000AB"' , { 5127-- 01234567 5128ast ={ 5129fmtn ( 'DoubleQuotedString' , 'val="«"' , ':0:0:"\\U000000AB"' ), 5130} , 5131} , { 5132hl ( 'DoubleQuote' , '"' ), 5133hl ( 'DoubleQuotedEscape' , '\\U000000AB' ), 5134hl ( 'DoubleQuote' , '"' ), 5135} ) 5136check_parsing ( '"\\x"' , { 5137-- 0123 5138ast ={ 5139fmtn ( 'DoubleQuotedString' , 'val="x"' , ':0:0:"\\x"' ), 5140} , 5141} , { 5142hl ( 'DoubleQuote' , '"' ), 5143hl ( 'DoubleQuotedUnknownEscape' , '\\x' ), 5144hl ( 'DoubleQuote' , '"' ), 5145} ) 5146 5147check_parsing ( '"\\x' , { 5148-- 012 5149ast ={ 5150fmtn ( 'DoubleQuotedString' , 'val="x"' , ':0:0:"\\x' ), 5151} , 5152err ={ 5153arg ='"\\x' , 5154msg ='E114: Missing double quote: %.*s' , 5155} , 5156} , { 5157hl ( 'InvalidDoubleQuote' , '"' ), 5158hl ( 'InvalidDoubleQuotedUnknownEscape' , '\\x' ), 5159} ) 5160 5161check_parsing ( '"\\xF' , { 5162-- 0123 5163ast ={ 5164fmtn ( 'DoubleQuotedString' , 'val="\\015"' , ':0:0:"\\xF' ), 5165} , 5166err ={ 5167arg ='"\\xF' , 5168msg ='E114: Missing double quote: %.*s' , 5169} , 5170} , { 5171hl ( 'InvalidDoubleQuote' , '"' ), 5172hl ( 'InvalidDoubleQuotedEscape' , '\\xF' ), 5173} ) 5174 5175check_parsing ( '"\\u"' , { 5176-- 0123 5177ast ={ 5178fmtn ( 'DoubleQuotedString' , 'val="u"' , ':0:0:"\\u"' ), 5179} , 5180} , { 5181hl ( 'DoubleQuote' , '"' ), 5182hl ( 'DoubleQuotedUnknownEscape' , '\\u' ), 5183hl ( 'DoubleQuote' , '"' ), 5184} ) 5185 5186check_parsing ( '"\\u' , { 5187-- 012 5188ast ={ 5189fmtn ( 'DoubleQuotedString' , 'val="u"' , ':0:0:"\\u' ), 5190} , 5191err ={ 5192arg ='"\\u' , 5193msg ='E114: Missing double quote: %.*s' , 5194} , 5195} , { 5196hl ( 'InvalidDoubleQuote' , '"' ), 5197hl ( 'InvalidDoubleQuotedUnknownEscape' , '\\u' ), 5198} ) 5199 5200check_parsing ( '"\\U' , { 5201-- 012 5202ast ={ 5203fmtn ( 'DoubleQuotedString' , 'val="U"' , ':0:0:"\\U' ), 5204} , 5205err ={ 5206arg ='"\\U' , 5207msg ='E114: Missing double quote: %.*s' , 5208} , 5209} , { 5210hl ( 'InvalidDoubleQuote' , '"' ), 5211hl ( 'InvalidDoubleQuotedUnknownEscape' , '\\U' ), 5212} ) 5213 5214check_parsing ( '"\\U"' , { 5215-- 0123 5216ast ={ 5217fmtn ( 'DoubleQuotedString' , 'val="U"' , ':0:0:"\\U"' ), 5218} , 5219} , { 5220hl ( 'DoubleQuote' , '"' ), 5221hl ( 'DoubleQuotedUnknownEscape' , '\\U' ), 5222hl ( 'DoubleQuote' , '"' ), 5223} ) 5224 5225check_parsing ( '"\\xFX"' , { 5226-- 012345 5227ast ={ 5228fmtn ( 'DoubleQuotedString' , 'val="\\015X"' , ':0:0:"\\xFX"' ), 5229} , 5230} , { 5231hl ( 'DoubleQuote' , '"' ), 5232hl ( 'DoubleQuotedEscape' , '\\xF' ), 5233hl ( 'DoubleQuotedBody' , 'X' ), 5234hl ( 'DoubleQuote' , '"' ), 5235} ) 5236 5237check_parsing ( '"\\XFX"' , { 5238-- 012345 5239ast ={ 5240fmtn ( 'DoubleQuotedString' , 'val="\\015X"' , ':0:0:"\\XFX"' ), 5241} , 5242} , { 5243hl ( 'DoubleQuote' , '"' ), 5244hl ( 'DoubleQuotedEscape' , '\\XF' ), 5245hl ( 'DoubleQuotedBody' , 'X' ), 5246hl ( 'DoubleQuote' , '"' ), 5247} ) 5248 5249check_parsing ( '"\\xX"' , { 5250-- 01234 5251ast ={ 5252fmtn ( 'DoubleQuotedString' , 'val="xX"' , ':0:0:"\\xX"' ), 5253} , 5254} , { 5255hl ( 'DoubleQuote' , '"' ), 5256hl ( 'DoubleQuotedUnknownEscape' , '\\x' ), 5257hl ( 'DoubleQuotedBody' , 'X' ), 5258hl ( 'DoubleQuote' , '"' ), 5259} ) 5260 5261check_parsing ( '"\\XX"' , { 5262-- 01234 5263ast ={ 5264fmtn ( 'DoubleQuotedString' , 'val="XX"' , ':0:0:"\\XX"' ), 5265} , 5266} , { 5267hl ( 'DoubleQuote' , '"' ), 5268hl ( 'DoubleQuotedUnknownEscape' , '\\X' ), 5269hl ( 'DoubleQuotedBody' , 'X' ), 5270hl ( 'DoubleQuote' , '"' ), 5271} ) 5272 5273check_parsing ( '"\\uX"' , { 5274-- 01234 5275ast ={ 5276fmtn ( 'DoubleQuotedString' , 'val="uX"' , ':0:0:"\\uX"' ), 5277} , 5278} , { 5279hl ( 'DoubleQuote' , '"' ), 5280hl ( 'DoubleQuotedUnknownEscape' , '\\u' ), 5281hl ( 'DoubleQuotedBody' , 'X' ), 5282hl ( 'DoubleQuote' , '"' ), 5283} ) 5284 5285check_parsing ( '"\\UX"' , { 5286-- 01234 5287ast ={ 5288fmtn ( 'DoubleQuotedString' , 'val="UX"' , ':0:0:"\\UX"' ), 5289} , 5290} , { 5291hl ( 'DoubleQuote' , '"' ), 5292hl ( 'DoubleQuotedUnknownEscape' , '\\U' ), 5293hl ( 'DoubleQuotedBody' , 'X' ), 5294hl ( 'DoubleQuote' , '"' ), 5295} ) 5296 5297check_parsing ( '"\\x0X"' , { 5298-- 012345 5299ast ={ 5300fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\x0X"' ), 5301} , 5302} , { 5303hl ( 'DoubleQuote' , '"' ), 5304hl ( 'DoubleQuotedEscape' , '\\x0' ), 5305hl ( 'DoubleQuotedBody' , 'X' ), 5306hl ( 'DoubleQuote' , '"' ), 5307} ) 5308 5309check_parsing ( '"\\X0X"' , { 5310-- 012345 5311ast ={ 5312fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\X0X"' ), 5313} , 5314} , { 5315hl ( 'DoubleQuote' , '"' ), 5316hl ( 'DoubleQuotedEscape' , '\\X0' ), 5317hl ( 'DoubleQuotedBody' , 'X' ), 5318hl ( 'DoubleQuote' , '"' ), 5319} ) 5320 5321check_parsing ( '"\\u0X"' , { 5322-- 012345 5323ast ={ 5324fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\u0X"' ), 5325} , 5326} , { 5327hl ( 'DoubleQuote' , '"' ), 5328hl ( 'DoubleQuotedEscape' , '\\u0' ), 5329hl ( 'DoubleQuotedBody' , 'X' ), 5330hl ( 'DoubleQuote' , '"' ), 5331} ) 5332 5333check_parsing ( '"\\U0X"' , { 5334-- 012345 5335ast ={ 5336fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\U0X"' ), 5337} , 5338} , { 5339hl ( 'DoubleQuote' , '"' ), 5340hl ( 'DoubleQuotedEscape' , '\\U0' ), 5341hl ( 'DoubleQuotedBody' , 'X' ), 5342hl ( 'DoubleQuote' , '"' ), 5343} ) 5344 5345check_parsing ( '"\\x00X"' , { 5346-- 0123456 5347ast ={ 5348fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\x00X"' ), 5349} , 5350} , { 5351hl ( 'DoubleQuote' , '"' ), 5352hl ( 'DoubleQuotedEscape' , '\\x00' ), 5353hl ( 'DoubleQuotedBody' , 'X' ), 5354hl ( 'DoubleQuote' , '"' ), 5355} ) 5356 5357check_parsing ( '"\\X00X"' , { 5358-- 0123456 5359ast ={ 5360fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\X00X"' ), 5361} , 5362} , { 5363hl ( 'DoubleQuote' , '"' ), 5364hl ( 'DoubleQuotedEscape' , '\\X00' ), 5365hl ( 'DoubleQuotedBody' , 'X' ), 5366hl ( 'DoubleQuote' , '"' ), 5367} ) 5368 5369check_parsing ( '"\\u00X"' , { 5370-- 0123456 5371ast ={ 5372fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\u00X"' ), 5373} , 5374} , { 5375hl ( 'DoubleQuote' , '"' ), 5376hl ( 'DoubleQuotedEscape' , '\\u00' ), 5377hl ( 'DoubleQuotedBody' , 'X' ), 5378hl ( 'DoubleQuote' , '"' ), 5379} ) 5380 5381check_parsing ( '"\\U00X"' , { 5382-- 0123456 5383ast ={ 5384fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\U00X"' ), 5385} , 5386} , { 5387hl ( 'DoubleQuote' , '"' ), 5388hl ( 'DoubleQuotedEscape' , '\\U00' ), 5389hl ( 'DoubleQuotedBody' , 'X' ), 5390hl ( 'DoubleQuote' , '"' ), 5391} ) 5392 5393check_parsing ( '"\\u000X"' , { 5394-- 01234567 5395ast ={ 5396fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\u000X"' ), 5397} , 5398} , { 5399hl ( 'DoubleQuote' , '"' ), 5400hl ( 'DoubleQuotedEscape' , '\\u000' ), 5401hl ( 'DoubleQuotedBody' , 'X' ), 5402hl ( 'DoubleQuote' , '"' ), 5403} ) 5404 5405check_parsing ( '"\\U000X"' , { 5406-- 01234567 5407ast ={ 5408fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\U000X"' ), 5409} , 5410} , { 5411hl ( 'DoubleQuote' , '"' ), 5412hl ( 'DoubleQuotedEscape' , '\\U000' ), 5413hl ( 'DoubleQuotedBody' , 'X' ), 5414hl ( 'DoubleQuote' , '"' ), 5415} ) 5416 5417check_parsing ( '"\\u0000X"' , { 5418-- 012345678 5419ast ={ 5420fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\u0000X"' ), 5421} , 5422} , { 5423hl ( 'DoubleQuote' , '"' ), 5424hl ( 'DoubleQuotedEscape' , '\\u0000' ), 5425hl ( 'DoubleQuotedBody' , 'X' ), 5426hl ( 'DoubleQuote' , '"' ), 5427} ) 5428 5429check_parsing ( '"\\U0000X"' , { 5430-- 012345678 5431ast ={ 5432fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\U0000X"' ), 5433} , 5434} , { 5435hl ( 'DoubleQuote' , '"' ), 5436hl ( 'DoubleQuotedEscape' , '\\U0000' ), 5437hl ( 'DoubleQuotedBody' , 'X' ), 5438hl ( 'DoubleQuote' , '"' ), 5439} ) 5440 5441check_parsing ( '"\\U00000X"' , { 5442-- 0123456789 5443ast ={ 5444fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\U00000X"' ), 5445} , 5446} , { 5447hl ( 'DoubleQuote' , '"' ), 5448hl ( 'DoubleQuotedEscape' , '\\U00000' ), 5449hl ( 'DoubleQuotedBody' , 'X' ), 5450hl ( 'DoubleQuote' , '"' ), 5451} ) 5452 5453check_parsing ( '"\\U000000X"' , { 5454-- 01234567890 5455-- 0 1 5456ast ={ 5457fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\U000000X"' ), 5458} , 5459} , { 5460hl ( 'DoubleQuote' , '"' ), 5461hl ( 'DoubleQuotedEscape' , '\\U000000' ), 5462hl ( 'DoubleQuotedBody' , 'X' ), 5463hl ( 'DoubleQuote' , '"' ), 5464} ) 5465 5466check_parsing ( '"\\U0000000X"' , { 5467-- 012345678901 5468-- 0 1 5469ast ={ 5470fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\U0000000X"' ), 5471} , 5472} , { 5473hl ( 'DoubleQuote' , '"' ), 5474hl ( 'DoubleQuotedEscape' , '\\U0000000' ), 5475hl ( 'DoubleQuotedBody' , 'X' ), 5476hl ( 'DoubleQuote' , '"' ), 5477} ) 5478 5479check_parsing ( '"\\U00000000X"' , { 5480-- 0123456789012 5481-- 0 1 5482ast ={ 5483fmtn ( 'DoubleQuotedString' , 'val="\\000X"' , ':0:0:"\\U00000000X"' ), 5484} , 5485} , { 5486hl ( 'DoubleQuote' , '"' ), 5487hl ( 'DoubleQuotedEscape' , '\\U00000000' ), 5488hl ( 'DoubleQuotedBody' , 'X' ), 5489hl ( 'DoubleQuote' , '"' ), 5490} ) 5491 5492check_parsing ( '"\\x000X"' , { 5493-- 01234567 5494ast ={ 5495fmtn ( 'DoubleQuotedString' , 'val="\\0000X"' , ':0:0:"\\x000X"' ), 5496} , 5497} , { 5498hl ( 'DoubleQuote' , '"' ), 5499hl ( 'DoubleQuotedEscape' , '\\x00' ), 5500hl ( 'DoubleQuotedBody' , '0X' ), 5501hl ( 'DoubleQuote' , '"' ), 5502} ) 5503 5504check_parsing ( '"\\X000X"' , { 5505-- 01234567 5506ast ={ 5507fmtn ( 'DoubleQuotedString' , 'val="\\0000X"' , ':0:0:"\\X000X"' ), 5508} , 5509} , { 5510hl ( 'DoubleQuote' , '"' ), 5511hl ( 'DoubleQuotedEscape' , '\\X00' ), 5512hl ( 'DoubleQuotedBody' , '0X' ), 5513hl ( 'DoubleQuote' , '"' ), 5514} ) 5515 5516check_parsing ( '"\\u00000X"' , { 5517-- 0123456789 5518ast ={ 5519fmtn ( 'DoubleQuotedString' , 'val="\\0000X"' , ':0:0:"\\u00000X"' ), 5520} , 5521} , { 5522hl ( 'DoubleQuote' , '"' ), 5523hl ( 'DoubleQuotedEscape' , '\\u0000' ), 5524hl ( 'DoubleQuotedBody' , '0X' ), 5525hl ( 'DoubleQuote' , '"' ), 5526} ) 5527 5528check_parsing ( '"\\U000000000X"' , { 5529-- 01234567890123 5530-- 0 1 5531ast ={ 5532fmtn ( 'DoubleQuotedString' , 'val="\\0000X"' , ':0:0:"\\U000000000X"' ), 5533} , 5534} , { 5535hl ( 'DoubleQuote' , '"' ), 5536hl ( 'DoubleQuotedEscape' , '\\U00000000' ), 5537hl ( 'DoubleQuotedBody' , '0X' ), 5538hl ( 'DoubleQuote' , '"' ), 5539} ) 5540 5541check_parsing ( '"\\0"' , { 5542-- 0123 5543ast ={ 5544fmtn ( 'DoubleQuotedString' , 'val="\\000"' , ':0:0:"\\0"' ), 5545} , 5546} , { 5547hl ( 'DoubleQuote' , '"' ), 5548hl ( 'DoubleQuotedEscape' , '\\0' ), 5549hl ( 'DoubleQuote' , '"' ), 5550} ) 5551 5552check_parsing ( '"\\00"' , { 5553-- 01234 5554ast ={ 5555fmtn ( 'DoubleQuotedString' , 'val="\\000"' , ':0:0:"\\00"' ), 5556} , 5557} , { 5558hl ( 'DoubleQuote' , '"' ), 5559hl ( 'DoubleQuotedEscape' , '\\00' ), 5560hl ( 'DoubleQuote' , '"' ), 5561} ) 5562 5563check_parsing ( '"\\000"' , { 5564-- 012345 5565ast ={ 5566fmtn ( 'DoubleQuotedString' , 'val="\\000"' , ':0:0:"\\000"' ), 5567} , 5568} , { 5569hl ( 'DoubleQuote' , '"' ), 5570hl ( 'DoubleQuotedEscape' , '\\000' ), 5571hl ( 'DoubleQuote' , '"' ), 5572} ) 5573 5574check_parsing ( '"\\0000"' , { 5575-- 0123456 5576ast ={ 5577fmtn ( 'DoubleQuotedString' , 'val="\\0000"' , ':0:0:"\\0000"' ), 5578} , 5579} , { 5580hl ( 'DoubleQuote' , '"' ), 5581hl ( 'DoubleQuotedEscape' , '\\000' ), 5582hl ( 'DoubleQuotedBody' , '0' ), 5583hl ( 'DoubleQuote' , '"' ), 5584} ) 5585 5586check_parsing ( '"\\8"' , { 5587-- 0123 5588ast ={ 5589fmtn ( 'DoubleQuotedString' , 'val="8"' , ':0:0:"\\8"' ), 5590} , 5591} , { 5592hl ( 'DoubleQuote' , '"' ), 5593hl ( 'DoubleQuotedUnknownEscape' , '\\8' ), 5594hl ( 'DoubleQuote' , '"' ), 5595} ) 5596 5597check_parsing ( '"\\08"' , { 5598-- 01234 5599ast ={ 5600fmtn ( 'DoubleQuotedString' , 'val="\\0008"' , ':0:0:"\\08"' ), 5601} , 5602} , { 5603hl ( 'DoubleQuote' , '"' ), 5604hl ( 'DoubleQuotedEscape' , '\\0' ), 5605hl ( 'DoubleQuotedBody' , '8' ), 5606hl ( 'DoubleQuote' , '"' ), 5607} ) 5608 5609check_parsing ( '"\\008"' , { 5610-- 012345 5611ast ={ 5612fmtn ( 'DoubleQuotedString' , 'val="\\0008"' , ':0:0:"\\008"' ), 5613} , 5614} , { 5615hl ( 'DoubleQuote' , '"' ), 5616hl ( 'DoubleQuotedEscape' , '\\00' ), 5617hl ( 'DoubleQuotedBody' , '8' ), 5618hl ( 'DoubleQuote' , '"' ), 5619} ) 5620 5621check_parsing ( '"\\0008"' , { 5622-- 0123456 5623ast ={ 5624fmtn ( 'DoubleQuotedString' , 'val="\\0008"' , ':0:0:"\\0008"' ), 5625} , 5626} , { 5627hl ( 'DoubleQuote' , '"' ), 5628hl ( 'DoubleQuotedEscape' , '\\000' ), 5629hl ( 'DoubleQuotedBody' , '8' ), 5630hl ( 'DoubleQuote' , '"' ), 5631} ) 5632 5633check_parsing ( '"\\777"' , { 5634-- 012345 5635ast ={ 5636fmtn ( 'DoubleQuotedString' , 'val="\255"' , ':0:0:"\\777"' ), 5637} , 5638} , { 5639hl ( 'DoubleQuote' , '"' ), 5640hl ( 'DoubleQuotedEscape' , '\\777' ), 5641hl ( 'DoubleQuote' , '"' ), 5642} ) 5643 5644check_parsing ( '"\\050"' , { 5645-- 012345 5646ast ={ 5647fmtn ( 'DoubleQuotedString' , 'val="\40"' , ':0:0:"\\050"' ), 5648} , 5649} , { 5650hl ( 'DoubleQuote' , '"' ), 5651hl ( 'DoubleQuotedEscape' , '\\050' ), 5652hl ( 'DoubleQuote' , '"' ), 5653} ) 5654 5655check_parsing ( '"\\<C-u>"' , { 5656-- 012345 5657ast ={ 5658fmtn ( 'DoubleQuotedString' , 'val="\\021"' , ':0:0:"\\<C-u>"' ), 5659} , 5660} , { 5661hl ( 'DoubleQuote' , '"' ), 5662hl ( 'DoubleQuotedEscape' , '\\<C-u>' ), 5663hl ( 'DoubleQuote' , '"' ), 5664} ) 5665 5666check_parsing ( '"\\<' , { 5667-- 012 5668ast ={ 5669fmtn ( 'DoubleQuotedString' , 'val="<"' , ':0:0:"\\<' ), 5670} , 5671err ={ 5672arg ='"\\<' , 5673msg ='E114: Missing double quote: %.*s' , 5674} , 5675} , { 5676hl ( 'InvalidDoubleQuote' , '"' ), 5677hl ( 'InvalidDoubleQuotedUnknownEscape' , '\\<' ), 5678} ) 5679 5680check_parsing ( '"\\<"' , { 5681-- 0123 5682ast ={ 5683fmtn ( 'DoubleQuotedString' , 'val="<"' , ':0:0:"\\<"' ), 5684} , 5685} , { 5686hl ( 'DoubleQuote' , '"' ), 5687hl ( 'DoubleQuotedUnknownEscape' , '\\<' ), 5688hl ( 'DoubleQuote' , '"' ), 5689} ) 5690 5691check_parsing ( '"\\<C-u"' , { 5692-- 0123456 5693ast ={ 5694fmtn ( 'DoubleQuotedString' , 'val="<C-u"' , ':0:0:"\\<C-u"' ), 5695} , 5696} , { 5697hl ( 'DoubleQuote' , '"' ), 5698hl ( 'DoubleQuotedUnknownEscape' , '\\<' ), 5699hl ( 'DoubleQuotedBody' , 'C-u' ), 5700hl ( 'DoubleQuote' , '"' ), 5701} ) 5702end ) 5703itp ( 'works with multiplication-like operators' , function () 5704check_parsing ( '2+2*2' , { 5705-- 01234 5706ast ={ 5707{ 5708'BinaryPlus:0:1:+' , 5709children ={ 5710'Integer(val=2):0:0:2' , 5711{ 5712'Multiplication:0:3:*' , 5713children ={ 5714'Integer(val=2):0:2:2' , 5715'Integer(val=2):0:4:2' , 5716} , 5717} , 5718} , 5719} , 5720} , 5721} , { 5722hl ( 'Number' , '2' ), 5723hl ( 'BinaryPlus' , '+' ), 5724hl ( 'Number' , '2' ), 5725hl ( 'Multiplication' , '*' ), 5726hl ( 'Number' , '2' ), 5727} ) 5728 5729check_parsing ( '2+2*' , { 5730-- 0123 5731ast ={ 5732{ 5733'BinaryPlus:0:1:+' , 5734children ={ 5735'Integer(val=2):0:0:2' , 5736{ 5737'Multiplication:0:3:*' , 5738children ={ 5739'Integer(val=2):0:2:2' , 5740} , 5741} , 5742} , 5743} , 5744} , 5745err ={ 5746arg ='' , 5747msg ='E15: Expected value, got EOC: %.*s' , 5748} , 5749} , { 5750hl ( 'Number' , '2' ), 5751hl ( 'BinaryPlus' , '+' ), 5752hl ( 'Number' , '2' ), 5753hl ( 'Multiplication' , '*' ), 5754} ) 5755 5756check_parsing ( '2+*2' , { 5757-- 0123 5758ast ={ 5759{ 5760'BinaryPlus:0:1:+' , 5761children ={ 5762'Integer(val=2):0:0:2' , 5763{ 5764'Multiplication:0:2:*' , 5765children ={ 5766'Missing:0:2:' , 5767'Integer(val=2):0:3:2' , 5768} , 5769} , 5770} , 5771} , 5772} , 5773err ={ 5774arg ='*2' , 5775msg ='E15: Unexpected multiplication-like operator: %.*s' , 5776} , 5777} , { 5778hl ( 'Number' , '2' ), 5779hl ( 'BinaryPlus' , '+' ), 5780hl ( 'InvalidMultiplication' , '*' ), 5781hl ( 'Number' , '2' ), 5782} ) 5783 5784check_parsing ( '2+2/2' , { 5785-- 01234 5786ast ={ 5787{ 5788'BinaryPlus:0:1:+' , 5789children ={ 5790'Integer(val=2):0:0:2' , 5791{ 5792'Division:0:3:/' , 5793children ={ 5794'Integer(val=2):0:2:2' , 5795'Integer(val=2):0:4:2' , 5796} , 5797} , 5798} , 5799} , 5800} , 5801} , { 5802hl ( 'Number' , '2' ), 5803hl ( 'BinaryPlus' , '+' ), 5804hl ( 'Number' , '2' ), 5805hl ( 'Division' , '/' ), 5806hl ( 'Number' , '2' ), 5807} ) 5808 5809check_parsing ( '2+2/' , { 5810-- 0123 5811ast ={ 5812{ 5813'BinaryPlus:0:1:+' , 5814children ={ 5815'Integer(val=2):0:0:2' , 5816{ 5817'Division:0:3:/' , 5818children ={ 5819'Integer(val=2):0:2:2' , 5820} , 5821} , 5822} , 5823} , 5824} , 5825err ={ 5826arg ='' , 5827msg ='E15: Expected value, got EOC: %.*s' , 5828} , 5829} , { 5830hl ( 'Number' , '2' ), 5831hl ( 'BinaryPlus' , '+' ), 5832hl ( 'Number' , '2' ), 5833hl ( 'Division' , '/' ), 5834} ) 5835 5836check_parsing ( '2+/2' , { 5837-- 0123 5838ast ={ 5839{ 5840'BinaryPlus:0:1:+' , 5841children ={ 5842'Integer(val=2):0:0:2' , 5843{ 5844'Division:0:2:/' , 5845children ={ 5846'Missing:0:2:' , 5847'Integer(val=2):0:3:2' , 5848} , 5849} , 5850} , 5851} , 5852} , 5853err ={ 5854arg ='/2' , 5855msg ='E15: Unexpected multiplication-like operator: %.*s' , 5856} , 5857} , { 5858hl ( 'Number' , '2' ), 5859hl ( 'BinaryPlus' , '+' ), 5860hl ( 'InvalidDivision' , '/' ), 5861hl ( 'Number' , '2' ), 5862} ) 5863 5864check_parsing ( '2+2%2' , { 5865-- 01234 5866ast ={ 5867{ 5868'BinaryPlus:0:1:+' , 5869children ={ 5870'Integer(val=2):0:0:2' , 5871{ 5872'Mod:0:3:%' , 5873children ={ 5874'Integer(val=2):0:2:2' , 5875'Integer(val=2):0:4:2' , 5876} , 5877} , 5878} , 5879} , 5880} , 5881} , { 5882hl ( 'Number' , '2' ), 5883hl ( 'BinaryPlus' , '+' ), 5884hl ( 'Number' , '2' ), 5885hl ( 'Mod' , '%' ), 5886hl ( 'Number' , '2' ), 5887} ) 5888 5889check_parsing ( '2+2%' , { 5890-- 0123 5891ast ={ 5892{ 5893'BinaryPlus:0:1:+' , 5894children ={ 5895'Integer(val=2):0:0:2' , 5896{ 5897'Mod:0:3:%' , 5898children ={ 5899'Integer(val=2):0:2:2' , 5900} , 5901} , 5902} , 5903} , 5904} , 5905err ={ 5906arg ='' , 5907msg ='E15: Expected value, got EOC: %.*s' , 5908} , 5909} , { 5910hl ( 'Number' , '2' ), 5911hl ( 'BinaryPlus' , '+' ), 5912hl ( 'Number' , '2' ), 5913hl ( 'Mod' , '%' ), 5914} ) 5915 5916check_parsing ( '2+%2' , { 5917-- 0123 5918ast ={ 5919{ 5920'BinaryPlus:0:1:+' , 5921children ={ 5922'Integer(val=2):0:0:2' , 5923{ 5924'Mod:0:2:%' , 5925children ={ 5926'Missing:0:2:' , 5927'Integer(val=2):0:3:2' , 5928} , 5929} , 5930} , 5931} , 5932} , 5933err ={ 5934arg ='%2' , 5935msg ='E15: Unexpected multiplication-like operator: %.*s' , 5936} , 5937} , { 5938hl ( 'Number' , '2' ), 5939hl ( 'BinaryPlus' , '+' ), 5940hl ( 'InvalidMod' , '%' ), 5941hl ( 'Number' , '2' ), 5942} ) 5943end ) 5944itp ( 'works with -' , function () 5945check_parsing ( '@a' , { 5946ast ={ 5947'Register(name=a):0:0:@a' , 5948} , 5949} , { 5950hl ( 'Register' , '@a' ), 5951} ) 5952check_parsing ( '-@a' , { 5953ast ={ 5954{ 5955'UnaryMinus:0:0:-' , 5956children ={ 5957'Register(name=a):0:1:@a' , 5958} , 5959} , 5960} , 5961} , { 5962hl ( 'UnaryMinus' , '-' ), 5963hl ( 'Register' , '@a' ), 5964} ) 5965check_parsing ( '@a-@b' , { 5966ast ={ 5967{ 5968'BinaryMinus:0:2:-' , 5969children ={ 5970'Register(name=a):0:0:@a' , 5971'Register(name=b):0:3:@b' , 5972} , 5973} , 5974} , 5975} , { 5976hl ( 'Register' , '@a' ), 5977hl ( 'BinaryMinus' , '-' ), 5978hl ( 'Register' , '@b' ), 5979} ) 5980check_parsing ( '@a-@b-@c' , { 5981ast ={ 5982{ 5983'BinaryMinus:0:5:-' , 5984children ={ 5985{ 5986'BinaryMinus:0:2:-' , 5987children ={ 5988'Register(name=a):0:0:@a' , 5989'Register(name=b):0:3:@b' , 5990} , 5991} , 5992'Register(name=c):0:6:@c' , 5993} , 5994} , 5995} , 5996} , { 5997hl ( 'Register' , '@a' ), 5998hl ( 'BinaryMinus' , '-' ), 5999hl ( 'Register' , '@b' ), 6000hl ( 'BinaryMinus' , '-' ), 6001hl ( 'Register' , '@c' ), 6002} ) 6003check_parsing ( '-@a-@b' , { 6004ast ={ 6005{ 6006'BinaryMinus:0:3:-' , 6007children ={ 6008{ 6009'UnaryMinus:0:0:-' , 6010children ={ 6011'Register(name=a):0:1:@a' , 6012} , 6013} , 6014'Register(name=b):0:4:@b' , 6015} , 6016} , 6017} , 6018} , { 6019hl ( 'UnaryMinus' , '-' ), 6020hl ( 'Register' , '@a' ), 6021hl ( 'BinaryMinus' , '-' ), 6022hl ( 'Register' , '@b' ), 6023} ) 6024check_parsing ( '-@a--@b' , { 6025ast ={ 6026{ 6027'BinaryMinus:0:3:-' , 6028children ={ 6029{ 6030'UnaryMinus:0:0:-' , 6031children ={ 6032'Register(name=a):0:1:@a' , 6033} , 6034} , 6035{ 6036'UnaryMinus:0:4:-' , 6037children ={ 6038'Register(name=b):0:5:@b' , 6039} , 6040} , 6041} , 6042} , 6043} , 6044} , { 6045hl ( 'UnaryMinus' , '-' ), 6046hl ( 'Register' , '@a' ), 6047hl ( 'BinaryMinus' , '-' ), 6048hl ( 'UnaryMinus' , '-' ), 6049hl ( 'Register' , '@b' ), 6050} ) 6051check_parsing ( '-' , { 6052ast ={ 6053'UnaryMinus:0:0:-' , 6054} , 6055err ={ 6056arg ='' , 6057msg ='E15: Expected value, got EOC: %.*s' , 6058} , 6059} , { 6060hl ( 'UnaryMinus' , '-' ), 6061} ) 6062check_parsing ( ' -' , { 6063ast ={ 6064'UnaryMinus:0:0: -' , 6065} , 6066err ={ 6067arg ='' , 6068msg ='E15: Expected value, got EOC: %.*s' , 6069} , 6070} , { 6071hl ( 'UnaryMinus' , '-' , 1 ), 6072} ) 6073check_parsing ( '@a- ' , { 6074ast ={ 6075{ 6076'BinaryMinus:0:2:-' , 6077children ={ 6078'Register(name=a):0:0:@a' , 6079} , 6080} , 6081} , 6082err ={ 6083arg ='' , 6084msg ='E15: Expected value, got EOC: %.*s' , 6085} , 6086} , { 6087hl ( 'Register' , '@a' ), 6088hl ( 'BinaryMinus' , '-' ), 6089} ) 6090end ) 6091itp ( 'works with logical operators' , function () 6092check_parsing ( 'a && b || c && d' , { 6093-- 0123456789012345 6094-- 0 1 6095ast ={ 6096{ 6097'Or:0:6: ||' , 6098children ={ 6099{ 6100'And:0:1: &&' , 6101children ={ 6102'PlainIdentifier(scope=0,ident=a):0:0:a' , 6103'PlainIdentifier(scope=0,ident=b):0:4: b' , 6104} , 6105} , 6106{ 6107'And:0:11: &&' , 6108children ={ 6109'PlainIdentifier(scope=0,ident=c):0:9: c' , 6110'PlainIdentifier(scope=0,ident=d):0:14: d' , 6111} , 6112} , 6113} , 6114} , 6115} , 6116} , { 6117hl ( 'IdentifierName' , 'a' ), 6118hl ( 'And' , '&&' , 1 ), 6119hl ( 'IdentifierName' , 'b' , 1 ), 6120hl ( 'Or' , '||' , 1 ), 6121hl ( 'IdentifierName' , 'c' , 1 ), 6122hl ( 'And' , '&&' , 1 ), 6123hl ( 'IdentifierName' , 'd' , 1 ), 6124} ) 6125 6126check_parsing ( '&& a' , { 6127-- 0123 6128ast ={ 6129{ 6130'And:0:0:&&' , 6131children ={ 6132'Missing:0:0:' , 6133'PlainIdentifier(scope=0,ident=a):0:2: a' , 6134} , 6135} , 6136} , 6137err ={ 6138arg ='&& a' , 6139msg ='E15: Unexpected and operator: %.*s' , 6140} , 6141} , { 6142hl ( 'InvalidAnd' , '&&' ), 6143hl ( 'IdentifierName' , 'a' , 1 ), 6144} ) 6145 6146check_parsing ( '|| a' , { 6147-- 0123 6148ast ={ 6149{ 6150'Or:0:0:||' , 6151children ={ 6152'Missing:0:0:' , 6153'PlainIdentifier(scope=0,ident=a):0:2: a' , 6154} , 6155} , 6156} , 6157err ={ 6158arg ='|| a' , 6159msg ='E15: Unexpected or operator: %.*s' , 6160} , 6161} , { 6162hl ( 'InvalidOr' , '||' ), 6163hl ( 'IdentifierName' , 'a' , 1 ), 6164} ) 6165 6166check_parsing ( 'a||' , { 6167-- 012 6168ast ={ 6169{ 6170'Or:0:1:||' , 6171children ={ 6172'PlainIdentifier(scope=0,ident=a):0:0:a' , 6173} , 6174} , 6175} , 6176err ={ 6177arg ='' , 6178msg ='E15: Expected value, got EOC: %.*s' , 6179} , 6180} , { 6181hl ( 'IdentifierName' , 'a' ), 6182hl ( 'Or' , '||' ), 6183} ) 6184 6185check_parsing ( 'a&&' , { 6186-- 012 6187ast ={ 6188{ 6189'And:0:1:&&' , 6190children ={ 6191'PlainIdentifier(scope=0,ident=a):0:0:a' , 6192} , 6193} , 6194} , 6195err ={ 6196arg ='' , 6197msg ='E15: Expected value, got EOC: %.*s' , 6198} , 6199} , { 6200hl ( 'IdentifierName' , 'a' ), 6201hl ( 'And' , '&&' ), 6202} ) 6203 6204check_parsing ( '(&&)' , { 6205-- 0123 6206ast ={ 6207{ 6208'Nested:0:0:(' , 6209children ={ 6210{ 6211'And:0:1:&&' , 6212children ={ 6213'Missing:0:1:' , 6214'Missing:0:3:' , 6215} , 6216} , 6217} , 6218} , 6219} , 6220err ={ 6221arg ='&&)' , 6222msg ='E15: Unexpected and operator: %.*s' , 6223} , 6224} , { 6225hl ( 'NestingParenthesis' , '(' ), 6226hl ( 'InvalidAnd' , '&&' ), 6227hl ( 'InvalidNestingParenthesis' , ')' ), 6228} ) 6229 6230check_parsing ( '(||)' , { 6231-- 0123 6232ast ={ 6233{ 6234'Nested:0:0:(' , 6235children ={ 6236{ 6237'Or:0:1:||' , 6238children ={ 6239'Missing:0:1:' , 6240'Missing:0:3:' , 6241} , 6242} , 6243} , 6244} , 6245} , 6246err ={ 6247arg ='||)' , 6248msg ='E15: Unexpected or operator: %.*s' , 6249} , 6250} , { 6251hl ( 'NestingParenthesis' , '(' ), 6252hl ( 'InvalidOr' , '||' ), 6253hl ( 'InvalidNestingParenthesis' , ')' ), 6254} ) 6255 6256check_parsing ( '(a||)' , { 6257-- 01234 6258ast ={ 6259{ 6260'Nested:0:0:(' , 6261children ={ 6262{ 6263'Or:0:2:||' , 6264children ={ 6265'PlainIdentifier(scope=0,ident=a):0:1:a' , 6266'Missing:0:4:' , 6267} , 6268} , 6269} , 6270} , 6271} , 6272err ={ 6273arg =')' , 6274msg ='E15: Expected value, got parenthesis: %.*s' , 6275} , 6276} , { 6277hl ( 'NestingParenthesis' , '(' ), 6278hl ( 'IdentifierName' , 'a' ), 6279hl ( 'Or' , '||' ), 6280hl ( 'InvalidNestingParenthesis' , ')' ), 6281} ) 6282 6283check_parsing ( '(a&&)' , { 6284-- 01234 6285ast ={ 6286{ 6287'Nested:0:0:(' , 6288children ={ 6289{ 6290'And:0:2:&&' , 6291children ={ 6292'PlainIdentifier(scope=0,ident=a):0:1:a' , 6293'Missing:0:4:' , 6294} , 6295} , 6296} , 6297} , 6298} , 6299err ={ 6300arg =')' , 6301msg ='E15: Expected value, got parenthesis: %.*s' , 6302} , 6303} , { 6304hl ( 'NestingParenthesis' , '(' ), 6305hl ( 'IdentifierName' , 'a' ), 6306hl ( 'And' , '&&' ), 6307hl ( 'InvalidNestingParenthesis' , ')' ), 6308} ) 6309 6310check_parsing ( '(&&a)' , { 6311-- 01234 6312ast ={ 6313{ 6314'Nested:0:0:(' , 6315children ={ 6316{ 6317'And:0:1:&&' , 6318children ={ 6319'Missing:0:1:' , 6320'PlainIdentifier(scope=0,ident=a):0:3:a' , 6321} , 6322} , 6323} , 6324} , 6325} , 6326err ={ 6327arg ='&&a)' , 6328msg ='E15: Unexpected and operator: %.*s' , 6329} , 6330} , { 6331hl ( 'NestingParenthesis' , '(' ), 6332hl ( 'InvalidAnd' , '&&' ), 6333hl ( 'IdentifierName' , 'a' ), 6334hl ( 'NestingParenthesis' , ')' ), 6335} ) 6336 6337check_parsing ( '(||a)' , { 6338-- 01234 6339ast ={ 6340{ 6341'Nested:0:0:(' , 6342children ={ 6343{ 6344'Or:0:1:||' , 6345children ={ 6346'Missing:0:1:' , 6347'PlainIdentifier(scope=0,ident=a):0:3:a' , 6348} , 6349} , 6350} , 6351} , 6352} , 6353err ={ 6354arg ='||a)' , 6355msg ='E15: Unexpected or operator: %.*s' , 6356} , 6357} , { 6358hl ( 'NestingParenthesis' , '(' ), 6359hl ( 'InvalidOr' , '||' ), 6360hl ( 'IdentifierName' , 'a' ), 6361hl ( 'NestingParenthesis' , ')' ), 6362} ) 6363end ) 6364itp ( 'works with &opt' , function () 6365check_parsing ( '&' , { 6366-- 0 6367ast ={ 6368'Option(scope=0,ident=):0:0:&' , 6369} , 6370err ={ 6371arg ='&' , 6372msg ='E112: Option name missing: %.*s' , 6373} , 6374} , { 6375hl ( 'InvalidOptionSigil' , '&' ), 6376} ) 6377 6378check_parsing ( '&opt' , { 6379-- 0123 6380ast ={ 6381'Option(scope=0,ident=opt):0:0:&opt' , 6382} , 6383} , { 6384hl ( 'OptionSigil' , '&' ), 6385hl ( 'OptionName' , 'opt' ), 6386} ) 6387 6388check_parsing ( '&l:opt' , { 6389-- 012345 6390ast ={ 6391'Option(scope=l,ident=opt):0:0:&l:opt' , 6392} , 6393} , { 6394hl ( 'OptionSigil' , '&' ), 6395hl ( 'OptionScope' , 'l' ), 6396hl ( 'OptionScopeDelimiter' , ':' ), 6397hl ( 'OptionName' , 'opt' ), 6398} ) 6399 6400check_parsing ( '&g:opt' , { 6401-- 012345 6402ast ={ 6403'Option(scope=g,ident=opt):0:0:&g:opt' , 6404} , 6405} , { 6406hl ( 'OptionSigil' , '&' ), 6407hl ( 'OptionScope' , 'g' ), 6408hl ( 'OptionScopeDelimiter' , ':' ), 6409hl ( 'OptionName' , 'opt' ), 6410} ) 6411 6412check_parsing ( '&s:opt' , { 6413-- 012345 6414ast ={ 6415{ 6416'Colon:0:2::' , 6417children ={ 6418'Option(scope=0,ident=s):0:0:&s' , 6419'PlainIdentifier(scope=0,ident=opt):0:3:opt' , 6420} , 6421} , 6422} , 6423err ={ 6424arg =':opt' , 6425msg ='E15: Colon outside of dictionary or ternary operator: %.*s' , 6426} , 6427} , { 6428hl ( 'OptionSigil' , '&' ), 6429hl ( 'OptionName' , 's' ), 6430hl ( 'InvalidColon' , ':' ), 6431hl ( 'IdentifierName' , 'opt' ), 6432} ) 6433 6434check_parsing ( '& ' , { 6435-- 01 6436ast ={ 6437'Option(scope=0,ident=):0:0:&' , 6438} , 6439err ={ 6440arg ='& ' , 6441msg ='E112: Option name missing: %.*s' , 6442} , 6443} , { 6444hl ( 'InvalidOptionSigil' , '&' ), 6445} ) 6446 6447check_parsing ( '&-' , { 6448-- 01 6449ast ={ 6450{ 6451'BinaryMinus:0:1:-' , 6452children ={ 6453'Option(scope=0,ident=):0:0:&' , 6454} , 6455} , 6456} , 6457err ={ 6458arg ='&-' , 6459msg ='E112: Option name missing: %.*s' , 6460} , 6461} , { 6462hl ( 'InvalidOptionSigil' , '&' ), 6463hl ( 'BinaryMinus' , '-' ), 6464} ) 6465 6466check_parsing ( '&A' , { 6467-- 01 6468ast ={ 6469'Option(scope=0,ident=A):0:0:&A' , 6470} , 6471} , { 6472hl ( 'OptionSigil' , '&' ), 6473hl ( 'OptionName' , 'A' ), 6474} ) 6475 6476check_parsing ( '&xxx_yyy' , { 6477-- 01234567 6478ast ={ 6479{ 6480'OpMissing:0:4:' , 6481children ={ 6482'Option(scope=0,ident=xxx):0:0:&xxx' , 6483'PlainIdentifier(scope=0,ident=_yyy):0:4:_yyy' , 6484} , 6485} , 6486} , 6487err ={ 6488arg ='_yyy' , 6489msg ='E15: Missing operator: %.*s' , 6490} , 6491} , { 6492hl ( 'OptionSigil' , '&' ), 6493hl ( 'OptionName' , 'xxx' ), 6494hl ( 'InvalidIdentifierName' , '_yyy' ), 6495} , { 6496[ 1 ] ={ 6497ast ={ 6498len =4 , 6499err =REMOVE_THIS , 6500ast ={ 6501'Option(scope=0,ident=xxx):0:0:&xxx' , 6502} , 6503} , 6504hl_fs ={ 6505[ 3 ] =REMOVE_THIS , 6506} , 6507} , 6508} ) 6509 6510check_parsing ( '(1+&)' , { 6511-- 01234 6512ast ={ 6513{ 6514'Nested:0:0:(' , 6515children ={ 6516{ 6517'BinaryPlus:0:2:+' , 6518children ={ 6519'Integer(val=1):0:1:1' , 6520'Option(scope=0,ident=):0:3:&' , 6521} , 6522} , 6523} , 6524} , 6525} , 6526err ={ 6527arg ='&)' , 6528msg ='E112: Option name missing: %.*s' , 6529} , 6530} , { 6531hl ( 'NestingParenthesis' , '(' ), 6532hl ( 'Number' , '1' ), 6533hl ( 'BinaryPlus' , '+' ), 6534hl ( 'InvalidOptionSigil' , '&' ), 6535hl ( 'NestingParenthesis' , ')' ), 6536} ) 6537 6538check_parsing ( '(&+1)' , { 6539-- 01234 6540ast ={ 6541{ 6542'Nested:0:0:(' , 6543children ={ 6544{ 6545'BinaryPlus:0:2:+' , 6546children ={ 6547'Option(scope=0,ident=):0:1:&' , 6548'Integer(val=1):0:3:1' , 6549} , 6550} , 6551} , 6552} , 6553} , 6554err ={ 6555arg ='&+1)' , 6556msg ='E112: Option name missing: %.*s' , 6557} , 6558} , { 6559hl ( 'NestingParenthesis' , '(' ), 6560hl ( 'InvalidOptionSigil' , '&' ), 6561hl ( 'BinaryPlus' , '+' ), 6562hl ( 'Number' , '1' ), 6563hl ( 'NestingParenthesis' , ')' ), 6564} ) 6565end ) 6566itp ( 'works with $ENV' , function () 6567check_parsing ( '$' , { 6568-- 0 6569ast ={ 6570'Environment(ident=):0:0:$' , 6571} , 6572err ={ 6573arg ='$' , 6574msg ='E15: Environment variable name missing' , 6575} , 6576} , { 6577hl ( 'InvalidEnvironmentSigil' , '$' ), 6578} ) 6579 6580check_parsing ( '$g:A' , { 6581-- 0123 6582ast ={ 6583{ 6584'Colon:0:2::' , 6585children ={ 6586'Environment(ident=g):0:0:$g' , 6587'PlainIdentifier(scope=0,ident=A):0:3:A' , 6588} , 6589} , 6590} , 6591err ={ 6592arg =':A' , 6593msg ='E15: Colon outside of dictionary or ternary operator: %.*s' , 6594} , 6595} , { 6596hl ( 'EnvironmentSigil' , '$' ), 6597hl ( 'EnvironmentName' , 'g' ), 6598hl ( 'InvalidColon' , ':' ), 6599hl ( 'IdentifierName' , 'A' ), 6600} ) 6601 6602check_parsing ( '$A' , { 6603-- 01 6604ast ={ 6605'Environment(ident=A):0:0:$A' , 6606} , 6607} , { 6608hl ( 'EnvironmentSigil' , '$' ), 6609hl ( 'EnvironmentName' , 'A' ), 6610} ) 6611 6612check_parsing ( '$ABC' , { 6613-- 0123 6614ast ={ 6615'Environment(ident=ABC):0:0:$ABC' , 6616} , 6617} , { 6618hl ( 'EnvironmentSigil' , '$' ), 6619hl ( 'EnvironmentName' , 'ABC' ), 6620} ) 6621 6622check_parsing ( '(1+$)' , { 6623-- 01234 6624ast ={ 6625{ 6626'Nested:0:0:(' , 6627children ={ 6628{ 6629'BinaryPlus:0:2:+' , 6630children ={ 6631'Integer(val=1):0:1:1' , 6632'Environment(ident=):0:3:$' , 6633} , 6634} , 6635} , 6636} , 6637} , 6638err ={ 6639arg ='$)' , 6640msg ='E15: Environment variable name missing' , 6641} , 6642} , { 6643hl ( 'NestingParenthesis' , '(' ), 6644hl ( 'Number' , '1' ), 6645hl ( 'BinaryPlus' , '+' ), 6646hl ( 'InvalidEnvironmentSigil' , '$' ), 6647hl ( 'NestingParenthesis' , ')' ), 6648} ) 6649 6650check_parsing ( '($+1)' , { 6651-- 01234 6652ast ={ 6653{ 6654'Nested:0:0:(' , 6655children ={ 6656{ 6657'BinaryPlus:0:2:+' , 6658children ={ 6659'Environment(ident=):0:1:$' , 6660'Integer(val=1):0:3:1' , 6661} , 6662} , 6663} , 6664} , 6665} , 6666err ={ 6667arg ='$+1)' , 6668msg ='E15: Environment variable name missing' , 6669} , 6670} , { 6671hl ( 'NestingParenthesis' , '(' ), 6672hl ( 'InvalidEnvironmentSigil' , '$' ), 6673hl ( 'BinaryPlus' , '+' ), 6674hl ( 'Number' , '1' ), 6675hl ( 'NestingParenthesis' , ')' ), 6676} ) 6677 6678check_parsing ( '$_ABC' , { 6679-- 01234 6680ast ={ 6681'Environment(ident=_ABC):0:0:$_ABC' , 6682} , 6683} , { 6684hl ( 'EnvironmentSigil' , '$' ), 6685hl ( 'EnvironmentName' , '_ABC' ), 6686} ) 6687 6688check_parsing ( '$_' , { 6689-- 01 6690ast ={ 6691'Environment(ident=_):0:0:$_' , 6692} , 6693} , { 6694hl ( 'EnvironmentSigil' , '$' ), 6695hl ( 'EnvironmentName' , '_' ), 6696} ) 6697 6698check_parsing ( '$ABC_DEF' , { 6699-- 01234567 6700ast ={ 6701'Environment(ident=ABC_DEF):0:0:$ABC_DEF' , 6702} , 6703} , { 6704hl ( 'EnvironmentSigil' , '$' ), 6705hl ( 'EnvironmentName' , 'ABC_DEF' ), 6706} ) 6707end ) 6708itp ( 'works with unary !' , function () 6709check_parsing ( '!' , { 6710-- 0 6711ast ={ 6712'Not:0:0:!' , 6713} , 6714err ={ 6715arg ='' , 6716msg ='E15: Expected value, got EOC: %.*s' , 6717} , 6718} , { 6719hl ( 'Not' , '!' ), 6720} ) 6721 6722check_parsing ( '!!' , { 6723-- 01 6724ast ={ 6725{ 6726'Not:0:0:!' , 6727children ={ 6728'Not:0:1:!' , 6729} , 6730} , 6731} , 6732err ={ 6733arg ='' , 6734msg ='E15: Expected value, got EOC: %.*s' , 6735} , 6736} , { 6737hl ( 'Not' , '!' ), 6738hl ( 'Not' , '!' ), 6739} ) 6740 6741check_parsing ( '!!1' , { 6742-- 012 6743ast ={ 6744{ 6745'Not:0:0:!' , 6746children ={ 6747{ 6748'Not:0:1:!' , 6749children ={ 6750'Integer(val=1):0:2:1' , 6751} , 6752} , 6753} , 6754} , 6755} , 6756} , { 6757hl ( 'Not' , '!' ), 6758hl ( 'Not' , '!' ), 6759hl ( 'Number' , '1' ), 6760} ) 6761 6762check_parsing ( '!1' , { 6763-- 01 6764ast ={ 6765{ 6766'Not:0:0:!' , 6767children ={ 6768'Integer(val=1):0:1:1' , 6769} , 6770} , 6771} , 6772} , { 6773hl ( 'Not' , '!' ), 6774hl ( 'Number' , '1' ), 6775} ) 6776 6777check_parsing ( '(!1)' , { 6778-- 0123 6779ast ={ 6780{ 6781'Nested:0:0:(' , 6782children ={ 6783{ 6784'Not:0:1:!' , 6785children ={ 6786'Integer(val=1):0:2:1' , 6787} , 6788} , 6789} , 6790} , 6791} , 6792} , { 6793hl ( 'NestingParenthesis' , '(' ), 6794hl ( 'Not' , '!' ), 6795hl ( 'Number' , '1' ), 6796hl ( 'NestingParenthesis' , ')' ), 6797} ) 6798 6799check_parsing ( '(!)' , { 6800-- 012 6801ast ={ 6802{ 6803'Nested:0:0:(' , 6804children ={ 6805{ 6806'Not:0:1:!' , 6807children ={ 6808'Missing:0:2:' , 6809} , 6810} , 6811} , 6812} , 6813} , 6814err ={ 6815arg =')' , 6816msg ='E15: Expected value, got parenthesis: %.*s' , 6817} , 6818} , { 6819hl ( 'NestingParenthesis' , '(' ), 6820hl ( 'Not' , '!' ), 6821hl ( 'InvalidNestingParenthesis' , ')' ), 6822} ) 6823 6824check_parsing ( '(1!2)' , { 6825-- 01234 6826ast ={ 6827{ 6828'Nested:0:0:(' , 6829children ={ 6830{ 6831'OpMissing:0:2:' , 6832children ={ 6833'Integer(val=1):0:1:1' , 6834{ 6835'Not:0:2:!' , 6836children ={ 6837'Integer(val=2):0:3:2' , 6838} , 6839} , 6840} , 6841} , 6842} , 6843} , 6844} , 6845err ={ 6846arg ='!2)' , 6847msg ='E15: Missing operator: %.*s' , 6848} , 6849} , { 6850hl ( 'NestingParenthesis' , '(' ), 6851hl ( 'Number' , '1' ), 6852hl ( 'InvalidNot' , '!' ), 6853hl ( 'Number' , '2' ), 6854hl ( 'NestingParenthesis' , ')' ), 6855} ) 6856 6857check_parsing ( '1!2' , { 6858-- 012 6859ast ={ 6860{ 6861'OpMissing:0:1:' , 6862children ={ 6863'Integer(val=1):0:0:1' , 6864{ 6865'Not:0:1:!' , 6866children ={ 6867'Integer(val=2):0:2:2' , 6868} , 6869} , 6870} , 6871} , 6872} , 6873err ={ 6874arg ='!2' , 6875msg ='E15: Missing operator: %.*s' , 6876} , 6877} , { 6878hl ( 'Number' , '1' ), 6879hl ( 'InvalidNot' , '!' ), 6880hl ( 'Number' , '2' ), 6881} , { 6882[ 1 ] ={ 6883ast ={ 6884len =1 , 6885err =REMOVE_THIS , 6886ast ={ 6887'Integer(val=1):0:0:1' , 6888} , 6889} , 6890hl_fs ={ 6891[ 2 ] =REMOVE_THIS , 6892[ 3 ] =REMOVE_THIS , 6893} , 6894} , 6895} ) 6896end ) 6897itp ( 'highlights numbers with prefix' , function () 6898check_parsing ( '0xABCDEF' , { 6899-- 01234567 6900ast ={ 6901'Integer(val=11259375):0:0:0xABCDEF' , 6902} , 6903} , { 6904hl ( 'NumberPrefix' , '0x' ), 6905hl ( 'Number' , 'ABCDEF' ), 6906} ) 6907 6908check_parsing ( '0Xabcdef' , { 6909-- 01234567 6910ast ={ 6911'Integer(val=11259375):0:0:0Xabcdef' , 6912} , 6913} , { 6914hl ( 'NumberPrefix' , '0X' ), 6915hl ( 'Number' , 'abcdef' ), 6916} ) 6917 6918check_parsing ( '0XABCDEF' , { 6919-- 01234567 6920ast ={ 6921'Integer(val=11259375):0:0:0XABCDEF' , 6922} , 6923} , { 6924hl ( 'NumberPrefix' , '0X' ), 6925hl ( 'Number' , 'ABCDEF' ), 6926} ) 6927 6928check_parsing ( '0xabcdef' , { 6929-- 01234567 6930ast ={ 6931'Integer(val=11259375):0:0:0xabcdef' , 6932} , 6933} , { 6934hl ( 'NumberPrefix' , '0x' ), 6935hl ( 'Number' , 'abcdef' ), 6936} ) 6937 6938check_parsing ( '0b001' , { 6939-- 01234 6940ast ={ 6941'Integer(val=1):0:0:0b001' , 6942} , 6943} , { 6944hl ( 'NumberPrefix' , '0b' ), 6945hl ( 'Number' , '001' ), 6946} ) 6947 6948check_parsing ( '0B001' , { 6949-- 01234 6950ast ={ 6951'Integer(val=1):0:0:0B001' , 6952} , 6953} , { 6954hl ( 'NumberPrefix' , '0B' ), 6955hl ( 'Number' , '001' ), 6956} ) 6957 6958check_parsing ( '0B00' , { 6959-- 0123 6960ast ={ 6961'Integer(val=0):0:0:0B00' , 6962} , 6963} , { 6964hl ( 'NumberPrefix' , '0B' ), 6965hl ( 'Number' , '00' ), 6966} ) 6967 6968check_parsing ( '00' , { 6969-- 01 6970ast ={ 6971'Integer(val=0):0:0:00' , 6972} , 6973} , { 6974hl ( 'NumberPrefix' , '0' ), 6975hl ( 'Number' , '0' ), 6976} ) 6977 6978check_parsing ( '001' , { 6979-- 012 6980ast ={ 6981'Integer(val=1):0:0:001' , 6982} , 6983} , { 6984hl ( 'NumberPrefix' , '0' ), 6985hl ( 'Number' , '01' ), 6986} ) 6987 6988check_parsing ( '01' , { 6989-- 01 6990ast ={ 6991'Integer(val=1):0:0:01' , 6992} , 6993} , { 6994hl ( 'NumberPrefix' , '0' ), 6995hl ( 'Number' , '1' ), 6996} ) 6997 6998check_parsing ( '1' , { 6999-- 0 7000ast ={ 7001'Integer(val=1):0:0:1' , 7002} , 7003} , { 7004hl ( 'Number' , '1' ), 7005} ) 7006end ) 7007itp ( 'works (KLEE tests)' , function () 7008check_parsing ( '\0002&A:\000' , { 7009len =0 , 7010ast =nil , 7011err ={ 7012arg ='\0002&A:\000' , 7013msg ='E15: Expected value, got EOC: %.*s' , 7014} , 7015} , {} , { 7016[ 2 ] ={ 7017ast ={ 7018len =REMOVE_THIS , 7019ast ={ 7020{ 7021'Colon:0:4::' , 7022children ={ 7023{ 7024'OpMissing:0:2:' , 7025children ={ 7026'Integer(val=2):0:1:2' , 7027'Option(scope=0,ident=A):0:2:&A' , 7028} , 7029} , 7030} , 7031} , 7032} , 7033err ={ 7034msg ='E15: Unexpected EOC character: %.*s' , 7035} , 7036} , 7037hl_fs ={ 7038hl ( 'InvalidSpacing' , '\0' ), 7039hl ( 'Number' , '2' ), 7040hl ( 'InvalidOptionSigil' , '&' ), 7041hl ( 'InvalidOptionName' , 'A' ), 7042hl ( 'InvalidColon' , ':' ), 7043hl ( 'InvalidSpacing' , '\0' ), 7044} , 7045} , 7046[ 3 ] ={ 7047ast ={ 7048len =2 , 7049ast ={ 7050'Integer(val=2):0:1:2' , 7051} , 7052err ={ 7053msg ='E15: Unexpected EOC character: %.*s' , 7054} , 7055} , 7056hl_fs ={ 7057hl ( 'InvalidSpacing' , '\0' ), 7058hl ( 'Number' , '2' ), 7059} , 7060} , 7061} ) 7062check_parsing ( { data ='01' , size =1 } , { 7063len =1 , 7064ast ={ 7065'Integer(val=0):0:0:0' , 7066} , 7067} , { 7068hl ( 'Number' , '0' ), 7069} ) 7070check_parsing ( { data ='001' , size =2 } , { 7071len =2 , 7072ast ={ 7073'Integer(val=0):0:0:00' , 7074} , 7075} , { 7076hl ( 'NumberPrefix' , '0' ), 7077hl ( 'Number' , '0' ), 7078} ) 7079check_parsing ( '"\\U\\' , { 7080-- 0123 7081ast ={ 7082[[DoubleQuotedString(val="U\\"):0:0:"\U\]] , 7083} , 7084err ={ 7085arg ='"\\U\\' , 7086msg ='E114: Missing double quote: %.*s' , 7087} , 7088} , { 7089hl ( 'InvalidDoubleQuote' , '"' ), 7090hl ( 'InvalidDoubleQuotedUnknownEscape' , '\\U' ), 7091hl ( 'InvalidDoubleQuotedBody' , '\\' ), 7092} ) 7093check_parsing ( '"\\U' , { 7094-- 012 7095ast ={ 7096fmtn ( 'DoubleQuotedString' , 'val="U"' , ':0:0:"\\U' ), 7097} , 7098err ={ 7099arg ='"\\U' , 7100msg ='E114: Missing double quote: %.*s' , 7101} , 7102} , { 7103hl ( 'InvalidDoubleQuote' , '"' ), 7104hl ( 'InvalidDoubleQuotedUnknownEscape' , '\\U' ), 7105} ) 7106check_parsing ( '|"\\U\\' , { 7107-- 01234 7108len =0 , 7109err ={ 7110arg ='|"\\U\\' , 7111msg ='E15: Expected value, got EOC: %.*s' , 7112} , 7113} , {} , { 7114[ 2 ] ={ 7115ast ={ 7116len =REMOVE_THIS , 7117ast ={ 7118{ 7119'Or:0:0:|' , 7120children ={ 7121'Missing:0:0:' , 7122fmtn ( 'DoubleQuotedString' , 'val="U\\\\"' , ':0:1:"\\U\\' ), 7123} , 7124} , 7125} , 7126err ={ 7127msg ='E15: Unexpected EOC character: %.*s' , 7128} , 7129} , 7130hl_fs ={ 7131hl ( 'InvalidOr' , '|' ), 7132hl ( 'InvalidDoubleQuote' , '"' ), 7133hl ( 'InvalidDoubleQuotedUnknownEscape' , '\\U' ), 7134hl ( 'InvalidDoubleQuotedBody' , '\\' ), 7135} , 7136} , 7137} ) 7138check_parsing ( '|"\\e"' , { 7139-- 01234 7140len =0 , 7141err ={ 7142arg ='|"\\e"' , 7143msg ='E15: Expected value, got EOC: %.*s' , 7144} , 7145} , {} , { 7146[ 2 ] ={ 7147ast ={ 7148len =REMOVE_THIS , 7149ast ={ 7150{ 7151'Or:0:0:|' , 7152children ={ 7153'Missing:0:0:' , 7154fmtn ( 'DoubleQuotedString' , 'val="\\027"' , ':0:1:"\\e"' ), 7155} , 7156} , 7157} , 7158err ={ 7159msg ='E15: Unexpected EOC character: %.*s' , 7160} , 7161} , 7162hl_fs ={ 7163hl ( 'InvalidOr' , '|' ), 7164hl ( 'DoubleQuote' , '"' ), 7165hl ( 'DoubleQuotedEscape' , '\\e' ), 7166hl ( 'DoubleQuote' , '"' ), 7167} , 7168} , 7169} ) 7170check_parsing ( '|\029' , { 7171-- 01 7172len =0 , 7173err ={ 7174arg ='|\029' , 7175msg ='E15: Expected value, got EOC: %.*s' , 7176} , 7177} , {} , { 7178[ 2 ] ={ 7179ast ={ 7180len =REMOVE_THIS , 7181ast ={ 7182{ 7183'Or:0:0:|' , 7184children ={ 7185'Missing:0:0:' , 7186'PlainIdentifier(scope=0,ident=\029):0:1:\029' , 7187} , 7188} , 7189} , 7190err ={ 7191msg ='E15: Unexpected EOC character: %.*s' , 7192} , 7193} , 7194hl_fs ={ 7195hl ( 'InvalidOr' , '|' ), 7196hl ( 'InvalidIdentifierName' , '\029' ), 7197} , 7198} , 7199} ) 7200check_parsing ( '"\\<' , { 7201-- 012 7202ast ={ 7203fmtn ( 'DoubleQuotedString' , 'val="<"' , ':0:0:"\\<' ), 7204} , 7205err ={ 7206arg ='"\\<' , 7207msg ='E114: Missing double quote: %.*s' , 7208} , 7209} , { 7210hl ( 'InvalidDoubleQuote' , '"' ), 7211hl ( 'InvalidDoubleQuotedUnknownEscape' , '\\<' ), 7212} ) 7213check_parsing ( '"\\1' , { 7214-- 01 2 7215ast ={ 7216fmtn ( 'DoubleQuotedString' , 'val="\\001"' , ':0:0:"\\1' ), 7217} , 7218err ={ 7219arg ='"\\1' , 7220msg ='E114: Missing double quote: %.*s' , 7221} , 7222} , { 7223hl ( 'InvalidDoubleQuote' , '"' ), 7224hl ( 'InvalidDoubleQuotedEscape' , '\\1' ), 7225} ) 7226check_parsing ( '}l' , { 7227-- 01 7228ast ={ 7229{ 7230'OpMissing:0:1:' , 7231children ={ 7232fmtn ( 'UnknownFigure' , '---' , ':0:0:' ), 7233'PlainIdentifier(scope=0,ident=l):0:1:l' , 7234} , 7235} , 7236} , 7237err ={ 7238arg ='}l' , 7239msg ='E15: Unexpected closing figure brace: %.*s' , 7240} , 7241} , { 7242hl ( 'InvalidFigureBrace' , '}' ), 7243hl ( 'InvalidIdentifierName' , 'l' ), 7244} , { 7245[ 1 ] ={ 7246ast ={ 7247len =1 , 7248ast ={ 7249fmtn ( 'UnknownFigure' , '---' , ':0:0:' ), 7250} , 7251} , 7252hl_fs ={ 7253[ 2 ] =REMOVE_THIS , 7254} , 7255} , 7256} ) 7257check_parsing ( ':?\000\000\000\000\000\000\000' , { 7258len =2 , 7259ast ={ 7260{ 7261'Colon:0:0::' , 7262children ={ 7263'Missing:0:0:' , 7264{ 7265'Ternary:0:1:?' , 7266children ={ 7267'Missing:0:1:' , 7268'TernaryValue:0:1:?' , 7269} , 7270} , 7271} , 7272} , 7273} , 7274err ={ 7275arg =':?\000\000\000\000\000\000\000' , 7276msg ='E15: Colon outside of dictionary or ternary operator: %.*s' , 7277} , 7278} , { 7279hl ( 'InvalidColon' , ':' ), 7280hl ( 'InvalidTernary' , '?' ), 7281} , { 7282[ 2 ] ={ 7283ast ={ 7284len =REMOVE_THIS , 7285} , 7286hl_fs ={ 7287[ 3 ] =hl ( 'InvalidSpacing' , '\0' ), 7288[ 4 ] =hl ( 'InvalidSpacing' , '\0' ), 7289[ 5 ] =hl ( 'InvalidSpacing' , '\0' ), 7290[ 6 ] =hl ( 'InvalidSpacing' , '\0' ), 7291[ 7 ] =hl ( 'InvalidSpacing' , '\0' ), 7292[ 8 ] =hl ( 'InvalidSpacing' , '\0' ), 7293[ 9 ] =hl ( 'InvalidSpacing' , '\0' ), 7294} , 7295} , 7296} ) 7297end ) 7298itp ( 'works with assignments' , function () 7299check_asgn_parsing ( 'a=b' , { 7300-- 012 7301ast ={ 7302{ 7303'Assignment(Plain):0:1:=' , 7304children ={ 7305'PlainIdentifier(scope=0,ident=a):0:0:a' , 7306'PlainIdentifier(scope=0,ident=b):0:2:b' , 7307} , 7308} , 7309} , 7310} , { 7311hl ( 'IdentifierName' , 'a' ), 7312hl ( 'PlainAssignment' , '=' ), 7313hl ( 'IdentifierName' , 'b' ), 7314} ) 7315 7316check_asgn_parsing ( 'a+=b' , { 7317-- 0123 7318ast ={ 7319{ 7320'Assignment(Add):0:1:+=' , 7321children ={ 7322'PlainIdentifier(scope=0,ident=a):0:0:a' , 7323'PlainIdentifier(scope=0,ident=b):0:3:b' , 7324} , 7325} , 7326} , 7327} , { 7328hl ( 'IdentifierName' , 'a' ), 7329hl ( 'AssignmentWithAddition' , '+=' ), 7330hl ( 'IdentifierName' , 'b' ), 7331} ) 7332 7333check_asgn_parsing ( 'a-=b' , { 7334-- 0123 7335ast ={ 7336{ 7337'Assignment(Subtract):0:1:-=' , 7338children ={ 7339'PlainIdentifier(scope=0,ident=a):0:0:a' , 7340'PlainIdentifier(scope=0,ident=b):0:3:b' , 7341} , 7342} , 7343} , 7344} , { 7345hl ( 'IdentifierName' , 'a' ), 7346hl ( 'AssignmentWithSubtraction' , '-=' ), 7347hl ( 'IdentifierName' , 'b' ), 7348} ) 7349 7350check_asgn_parsing ( 'a.=b' , { 7351-- 0123 7352ast ={ 7353{ 7354'Assignment(Concat):0:1:.=' , 7355children ={ 7356'PlainIdentifier(scope=0,ident=a):0:0:a' , 7357'PlainIdentifier(scope=0,ident=b):0:3:b' , 7358} , 7359} , 7360} , 7361} , { 7362hl ( 'IdentifierName' , 'a' ), 7363hl ( 'AssignmentWithConcatenation' , '.=' ), 7364hl ( 'IdentifierName' , 'b' ), 7365} ) 7366 7367check_asgn_parsing ( 'a' , { 7368-- 0 7369ast ={ 7370'PlainIdentifier(scope=0,ident=a):0:0:a' , 7371} , 7372} , { 7373hl ( 'IdentifierName' , 'a' ), 7374} ) 7375 7376check_asgn_parsing ( 'a b' , { 7377-- 012 7378ast ={ 7379{ 7380'OpMissing:0:1:' , 7381children ={ 7382'PlainIdentifier(scope=0,ident=a):0:0:a' , 7383'PlainIdentifier(scope=0,ident=b):0:1: b' , 7384} , 7385} , 7386} , 7387err ={ 7388arg ='b' , 7389msg ='E15: Expected assignment operator or subscript: %.*s' , 7390} , 7391} , { 7392hl ( 'IdentifierName' , 'a' ), 7393hl ( 'InvalidSpacing' , ' ' ), 7394hl ( 'IdentifierName' , 'b' ), 7395} , { 7396[ 5 ] ={ 7397ast ={ 7398len =2 , 7399ast ={ 7400'PlainIdentifier(scope=0,ident=a):0:0:a' , 7401} , 7402err =REMOVE_THIS , 7403} , 7404hl_fs ={ 7405[ 2 ] =REMOVE_THIS , 7406[ 3 ] =REMOVE_THIS , 7407} , 7408} , 7409} ) 7410 7411check_asgn_parsing ( '[a, b, c]' , { 7412-- 012345678 7413ast ={ 7414{ 7415'ListLiteral:0:0:[' , 7416children ={ 7417{ 7418'Comma:0:2:,' , 7419children ={ 7420'PlainIdentifier(scope=0,ident=a):0:1:a' , 7421{ 7422'Comma:0:5:,' , 7423children ={ 7424'PlainIdentifier(scope=0,ident=b):0:3: b' , 7425'PlainIdentifier(scope=0,ident=c):0:6: c' , 7426} , 7427} , 7428} , 7429} , 7430} , 7431} , 7432} , 7433} , { 7434hl ( 'List' , '[' ), 7435hl ( 'IdentifierName' , 'a' ), 7436hl ( 'Comma' , ',' ), 7437hl ( 'IdentifierName' , 'b' , 1 ), 7438hl ( 'Comma' , ',' ), 7439hl ( 'IdentifierName' , 'c' , 1 ), 7440hl ( 'List' , ']' ), 7441} ) 7442 7443check_asgn_parsing ( '[a, b]' , { 7444-- 012345 7445ast ={ 7446{ 7447'ListLiteral:0:0:[' , 7448children ={ 7449{ 7450'Comma:0:2:,' , 7451children ={ 7452'PlainIdentifier(scope=0,ident=a):0:1:a' , 7453'PlainIdentifier(scope=0,ident=b):0:3: b' , 7454} , 7455} , 7456} , 7457} , 7458} , 7459} , { 7460hl ( 'List' , '[' ), 7461hl ( 'IdentifierName' , 'a' ), 7462hl ( 'Comma' , ',' ), 7463hl ( 'IdentifierName' , 'b' , 1 ), 7464hl ( 'List' , ']' ), 7465} ) 7466 7467check_asgn_parsing ( '[a]' , { 7468-- 012 7469ast ={ 7470{ 7471'ListLiteral:0:0:[' , 7472children ={ 7473'PlainIdentifier(scope=0,ident=a):0:1:a' , 7474} , 7475} , 7476} , 7477} , { 7478hl ( 'List' , '[' ), 7479hl ( 'IdentifierName' , 'a' ), 7480hl ( 'List' , ']' ), 7481} ) 7482 7483check_asgn_parsing ( '[]' , { 7484-- 01 7485ast ={ 7486'ListLiteral:0:0:[' , 7487} , 7488err ={ 7489arg =']' , 7490msg ='E475: Unable to assign to empty list: %.*s' , 7491} , 7492} , { 7493hl ( 'List' , '[' ), 7494hl ( 'InvalidList' , ']' ), 7495} ) 7496 7497check_asgn_parsing ( 'a[1] += 3' , { 7498-- 012345678 7499ast ={ 7500{ 7501'Assignment(Add):0:4: +=' , 7502children ={ 7503{ 7504'Subscript:0:1:[' , 7505children ={ 7506'PlainIdentifier(scope=0,ident=a):0:0:a' , 7507'Integer(val=1):0:2:1' , 7508} , 7509} , 7510'Integer(val=3):0:7: 3' , 7511} , 7512} , 7513} , 7514} , { 7515hl ( 'IdentifierName' , 'a' ), 7516hl ( 'SubscriptBracket' , '[' ), 7517hl ( 'Number' , '1' ), 7518hl ( 'SubscriptBracket' , ']' ), 7519hl ( 'AssignmentWithAddition' , '+=' , 1 ), 7520hl ( 'Number' , '3' , 1 ), 7521} ) 7522 7523check_asgn_parsing ( 'a[1 + 2] += 3' , { 7524-- 0123456789012 7525-- 0 1 7526ast ={ 7527{ 7528'Assignment(Add):0:8: +=' , 7529children ={ 7530{ 7531'Subscript:0:1:[' , 7532children ={ 7533'PlainIdentifier(scope=0,ident=a):0:0:a' , 7534{ 7535'BinaryPlus:0:3: +' , 7536children ={ 7537'Integer(val=1):0:2:1' , 7538'Integer(val=2):0:5: 2' , 7539} , 7540} , 7541} , 7542} , 7543'Integer(val=3):0:11: 3' , 7544} , 7545} , 7546} , 7547} , { 7548hl ( 'IdentifierName' , 'a' ), 7549hl ( 'SubscriptBracket' , '[' ), 7550hl ( 'Number' , '1' ), 7551hl ( 'BinaryPlus' , '+' , 1 ), 7552hl ( 'Number' , '2' , 1 ), 7553hl ( 'SubscriptBracket' , ']' ), 7554hl ( 'AssignmentWithAddition' , '+=' , 1 ), 7555hl ( 'Number' , '3' , 1 ), 7556} ) 7557 7558check_asgn_parsing ( 'a[{-> {b{3}: 4}[5]}()] += 6' , { 7559-- 012345678901234567890123456 7560-- 0 1 2 7561ast ={ 7562{ 7563'Assignment(Add):0:22: +=' , 7564children ={ 7565{ 7566'Subscript:0:1:[' , 7567children ={ 7568'PlainIdentifier(scope=0,ident=a):0:0:a' , 7569{ 7570'Call:0:19:(' , 7571children ={ 7572{ 7573fmtn ( 'Lambda' , '\\di' , ':0:2:{' ), 7574children ={ 7575{ 7576'Arrow:0:3:->' , 7577children ={ 7578{ 7579'Subscript:0:15:[' , 7580children ={ 7581{ 7582fmtn ( 'DictLiteral' , '-di' , ':0:5: {' ), 7583children ={ 7584{ 7585'Colon:0:11::' , 7586children ={ 7587{ 7588'ComplexIdentifier:0:8:' , 7589children ={ 7590'PlainIdentifier(scope=0,ident=b):0:7:b' , 7591{ 7592fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:8:{' ), 7593children ={ 7594'Integer(val=3):0:9:3' , 7595} , 7596} , 7597} , 7598} , 7599'Integer(val=4):0:12: 4' , 7600} , 7601} , 7602} , 7603} , 7604'Integer(val=5):0:16:5' , 7605} , 7606} , 7607} , 7608} , 7609} , 7610} , 7611} , 7612} , 7613} , 7614} , 7615'Integer(val=6):0:25: 6' , 7616} , 7617} , 7618} , 7619} , { 7620hl ( 'IdentifierName' , 'a' ), 7621hl ( 'SubscriptBracket' , '[' ), 7622hl ( 'Lambda' , '{' ), 7623hl ( 'Arrow' , '->' ), 7624hl ( 'Dict' , '{' , 1 ), 7625hl ( 'IdentifierName' , 'b' ), 7626hl ( 'Curly' , '{' ), 7627hl ( 'Number' , '3' ), 7628hl ( 'Curly' , '}' ), 7629hl ( 'Colon' , ':' ), 7630hl ( 'Number' , '4' , 1 ), 7631hl ( 'Dict' , '}' ), 7632hl ( 'SubscriptBracket' , '[' ), 7633hl ( 'Number' , '5' ), 7634hl ( 'SubscriptBracket' , ']' ), 7635hl ( 'Lambda' , '}' ), 7636hl ( 'CallingParenthesis' , '(' ), 7637hl ( 'CallingParenthesis' , ')' ), 7638hl ( 'SubscriptBracket' , ']' ), 7639hl ( 'AssignmentWithAddition' , '+=' , 1 ), 7640hl ( 'Number' , '6' , 1 ), 7641} ) 7642 7643check_asgn_parsing ( 'a{1}.2[{-> {b{3}: 4}[5]}()]' , { 7644-- 012345678901234567890123456 7645-- 0 1 2 7646ast ={ 7647{ 7648'Subscript:0:6:[' , 7649children ={ 7650{ 7651'ConcatOrSubscript:0:4:.' , 7652children ={ 7653{ 7654'ComplexIdentifier:0:1:' , 7655children ={ 7656'PlainIdentifier(scope=0,ident=a):0:0:a' , 7657{ 7658fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:1:{' ), 7659children ={ 7660'Integer(val=1):0:2:1' , 7661} , 7662} , 7663} , 7664} , 7665'PlainKey(key=2):0:5:2' , 7666} , 7667} , 7668{ 7669'Call:0:24:(' , 7670children ={ 7671{ 7672fmtn ( 'Lambda' , '\\di' , ':0:7:{' ), 7673children ={ 7674{ 7675'Arrow:0:8:->' , 7676children ={ 7677{ 7678'Subscript:0:20:[' , 7679children ={ 7680{ 7681fmtn ( 'DictLiteral' , '-di' , ':0:10: {' ), 7682children ={ 7683{ 7684'Colon:0:16::' , 7685children ={ 7686{ 7687'ComplexIdentifier:0:13:' , 7688children ={ 7689'PlainIdentifier(scope=0,ident=b):0:12:b' , 7690{ 7691fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:13:{' ), 7692children ={ 7693'Integer(val=3):0:14:3' , 7694} , 7695} , 7696} , 7697} , 7698'Integer(val=4):0:17: 4' , 7699} , 7700} , 7701} , 7702} , 7703'Integer(val=5):0:21:5' , 7704} , 7705} , 7706} , 7707} , 7708} , 7709} , 7710} , 7711} , 7712} , 7713} , 7714} , 7715} , { 7716hl ( 'IdentifierName' , 'a' ), 7717hl ( 'Curly' , '{' ), 7718hl ( 'Number' , '1' ), 7719hl ( 'Curly' , '}' ), 7720hl ( 'ConcatOrSubscript' , '.' ), 7721hl ( 'IdentifierKey' , '2' ), 7722hl ( 'SubscriptBracket' , '[' ), 7723hl ( 'Lambda' , '{' ), 7724hl ( 'Arrow' , '->' ), 7725hl ( 'Dict' , '{' , 1 ), 7726hl ( 'IdentifierName' , 'b' ), 7727hl ( 'Curly' , '{' ), 7728hl ( 'Number' , '3' ), 7729hl ( 'Curly' , '}' ), 7730hl ( 'Colon' , ':' ), 7731hl ( 'Number' , '4' , 1 ), 7732hl ( 'Dict' , '}' ), 7733hl ( 'SubscriptBracket' , '[' ), 7734hl ( 'Number' , '5' ), 7735hl ( 'SubscriptBracket' , ']' ), 7736hl ( 'Lambda' , '}' ), 7737hl ( 'CallingParenthesis' , '(' ), 7738hl ( 'CallingParenthesis' , ')' ), 7739hl ( 'SubscriptBracket' , ']' ), 7740} ) 7741 7742check_asgn_parsing ( 'a' , { 7743-- 0 7744ast ={ 7745'PlainIdentifier(scope=0,ident=a):0:0:a' , 7746} , 7747} , { 7748hl ( 'IdentifierName' , 'a' ), 7749} ) 7750 7751check_asgn_parsing ( '{a}' , { 7752-- 012 7753ast ={ 7754{ 7755fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:0:{' ), 7756children ={ 7757'PlainIdentifier(scope=0,ident=a):0:1:a' , 7758} , 7759} , 7760} , 7761} , { 7762hl ( 'FigureBrace' , '{' ), 7763hl ( 'IdentifierName' , 'a' ), 7764hl ( 'Curly' , '}' ), 7765} ) 7766 7767check_asgn_parsing ( '{a}b' , { 7768-- 0123 7769ast ={ 7770{ 7771'ComplexIdentifier:0:3:' , 7772children ={ 7773{ 7774fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:0:{' ), 7775children ={ 7776'PlainIdentifier(scope=0,ident=a):0:1:a' , 7777} , 7778} , 7779'PlainIdentifier(scope=0,ident=b):0:3:b' , 7780} , 7781} , 7782} , 7783} , { 7784hl ( 'FigureBrace' , '{' ), 7785hl ( 'IdentifierName' , 'a' ), 7786hl ( 'Curly' , '}' ), 7787hl ( 'IdentifierName' , 'b' ), 7788} ) 7789 7790check_asgn_parsing ( 'a{b}c' , { 7791-- 01234 7792ast ={ 7793{ 7794'ComplexIdentifier:0:1:' , 7795children ={ 7796'PlainIdentifier(scope=0,ident=a):0:0:a' , 7797{ 7798'ComplexIdentifier:0:4:' , 7799children ={ 7800{ 7801fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:1:{' ), 7802children ={ 7803'PlainIdentifier(scope=0,ident=b):0:2:b' , 7804} , 7805} , 7806'PlainIdentifier(scope=0,ident=c):0:4:c' , 7807} , 7808} , 7809} , 7810} , 7811} , 7812} , { 7813hl ( 'IdentifierName' , 'a' ), 7814hl ( 'Curly' , '{' ), 7815hl ( 'IdentifierName' , 'b' ), 7816hl ( 'Curly' , '}' ), 7817hl ( 'IdentifierName' , 'c' ), 7818} ) 7819 7820check_asgn_parsing ( 'a{b}c[0]' , { 7821-- 01234567 7822ast ={ 7823{ 7824'Subscript:0:5:[' , 7825children ={ 7826{ 7827'ComplexIdentifier:0:1:' , 7828children ={ 7829'PlainIdentifier(scope=0,ident=a):0:0:a' , 7830{ 7831'ComplexIdentifier:0:4:' , 7832children ={ 7833{ 7834fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:1:{' ), 7835children ={ 7836'PlainIdentifier(scope=0,ident=b):0:2:b' , 7837} , 7838} , 7839'PlainIdentifier(scope=0,ident=c):0:4:c' , 7840} , 7841} , 7842} , 7843} , 7844'Integer(val=0):0:6:0' , 7845} , 7846} , 7847} , 7848} , { 7849hl ( 'IdentifierName' , 'a' ), 7850hl ( 'Curly' , '{' ), 7851hl ( 'IdentifierName' , 'b' ), 7852hl ( 'Curly' , '}' ), 7853hl ( 'IdentifierName' , 'c' ), 7854hl ( 'SubscriptBracket' , '[' ), 7855hl ( 'Number' , '0' ), 7856hl ( 'SubscriptBracket' , ']' ), 7857} ) 7858 7859check_asgn_parsing ( 'a{b}c.0' , { 7860-- 0123456 7861ast ={ 7862{ 7863'ConcatOrSubscript:0:5:.' , 7864children ={ 7865{ 7866'ComplexIdentifier:0:1:' , 7867children ={ 7868'PlainIdentifier(scope=0,ident=a):0:0:a' , 7869{ 7870'ComplexIdentifier:0:4:' , 7871children ={ 7872{ 7873fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:1:{' ), 7874children ={ 7875'PlainIdentifier(scope=0,ident=b):0:2:b' , 7876} , 7877} , 7878'PlainIdentifier(scope=0,ident=c):0:4:c' , 7879} , 7880} , 7881} , 7882} , 7883'PlainKey(key=0):0:6:0' , 7884} , 7885} , 7886} , 7887} , { 7888hl ( 'IdentifierName' , 'a' ), 7889hl ( 'Curly' , '{' ), 7890hl ( 'IdentifierName' , 'b' ), 7891hl ( 'Curly' , '}' ), 7892hl ( 'IdentifierName' , 'c' ), 7893hl ( 'ConcatOrSubscript' , '.' ), 7894hl ( 'IdentifierKey' , '0' ), 7895} ) 7896 7897check_asgn_parsing ( '[a{b}c[0].0]' , { 7898-- 012345678901 7899-- 0 1 7900ast ={ 7901{ 7902'ListLiteral:0:0:[' , 7903children ={ 7904{ 7905'ConcatOrSubscript:0:9:.' , 7906children ={ 7907{ 7908'Subscript:0:6:[' , 7909children ={ 7910{ 7911'ComplexIdentifier:0:2:' , 7912children ={ 7913'PlainIdentifier(scope=0,ident=a):0:1:a' , 7914{ 7915'ComplexIdentifier:0:5:' , 7916children ={ 7917{ 7918fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:2:{' ), 7919children ={ 7920'PlainIdentifier(scope=0,ident=b):0:3:b' , 7921} , 7922} , 7923'PlainIdentifier(scope=0,ident=c):0:5:c' , 7924} , 7925} , 7926} , 7927} , 7928'Integer(val=0):0:7:0' , 7929} , 7930} , 7931'PlainKey(key=0):0:10:0' , 7932} , 7933} , 7934} , 7935} , 7936} , 7937} , { 7938hl ( 'List' , '[' ), 7939hl ( 'IdentifierName' , 'a' ), 7940hl ( 'Curly' , '{' ), 7941hl ( 'IdentifierName' , 'b' ), 7942hl ( 'Curly' , '}' ), 7943hl ( 'IdentifierName' , 'c' ), 7944hl ( 'SubscriptBracket' , '[' ), 7945hl ( 'Number' , '0' ), 7946hl ( 'SubscriptBracket' , ']' ), 7947hl ( 'ConcatOrSubscript' , '.' ), 7948hl ( 'IdentifierKey' , '0' ), 7949hl ( 'List' , ']' ), 7950} ) 7951 7952check_asgn_parsing ( '{a}{b}' , { 7953-- 012345 7954ast ={ 7955{ 7956'ComplexIdentifier:0:3:' , 7957children ={ 7958{ 7959fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:0:{' ), 7960children ={ 7961'PlainIdentifier(scope=0,ident=a):0:1:a' , 7962} , 7963} , 7964{ 7965fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:3:{' ), 7966children ={ 7967'PlainIdentifier(scope=0,ident=b):0:4:b' , 7968} , 7969} , 7970} , 7971} , 7972} , 7973} , { 7974hl ( 'FigureBrace' , '{' ), 7975hl ( 'IdentifierName' , 'a' ), 7976hl ( 'Curly' , '}' ), 7977hl ( 'Curly' , '{' ), 7978hl ( 'IdentifierName' , 'b' ), 7979hl ( 'Curly' , '}' ), 7980} ) 7981 7982check_asgn_parsing ( 'a.b{c}{d}' , { 7983-- 012345678 7984ast ={ 7985{ 7986'OpMissing:0:3:' , 7987children ={ 7988{ 7989'ConcatOrSubscript:0:1:.' , 7990children ={ 7991'PlainIdentifier(scope=0,ident=a):0:0:a' , 7992'PlainKey(key=b):0:2:b' , 7993} , 7994} , 7995{ 7996'ComplexIdentifier:0:6:' , 7997children ={ 7998{ 7999fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:3:{' ), 8000children ={ 8001'PlainIdentifier(scope=0,ident=c):0:4:c' , 8002} , 8003} , 8004{ 8005fmtn ( 'CurlyBracesIdentifier' , '--i' , ':0:6:{' ), 8006children ={ 8007'PlainIdentifier(scope=0,ident=d):0:7:d' , 8008} , 8009} , 8010} , 8011} , 8012} , 8013} , 8014} , 8015err ={ 8016arg ='{c}{d}' , 8017msg ='E15: Missing operator: %.*s' , 8018} , 8019} , { 8020hl ( 'IdentifierName' , 'a' ), 8021hl ( 'ConcatOrSubscript' , '.' ), 8022hl ( 'IdentifierKey' , 'b' ), 8023hl ( 'InvalidFigureBrace' , '{' ), 8024hl ( 'IdentifierName' , 'c' ), 8025hl ( 'Curly' , '}' ), 8026hl ( 'Curly' , '{' ), 8027hl ( 'IdentifierName' , 'd' ), 8028hl ( 'Curly' , '}' ), 8029} ) 8030 8031check_asgn_parsing ( '[a] = 1' , { 8032-- 0123456 8033ast ={ 8034{ 8035'Assignment(Plain):0:3: =' , 8036children ={ 8037{ 8038'ListLiteral:0:0:[' , 8039children ={ 8040'PlainIdentifier(scope=0,ident=a):0:1:a' , 8041} , 8042} , 8043'Integer(val=1):0:5: 1' , 8044} , 8045} , 8046} , 8047} , { 8048hl ( 'List' , '[' ), 8049hl ( 'IdentifierName' , 'a' ), 8050hl ( 'List' , ']' ), 8051hl ( 'PlainAssignment' , '=' , 1 ), 8052hl ( 'Number' , '1' , 1 ), 8053} ) 8054 8055check_asgn_parsing ( '[a[b], [c, [d, [e]]]] = 1' , { 8056-- 0123456789012345678901234 8057-- 0 1 2 8058ast ={ 8059{ 8060'Assignment(Plain):0:21: =' , 8061children ={ 8062{ 8063'ListLiteral:0:0:[' , 8064children ={ 8065{ 8066'Comma:0:5:,' , 8067children ={ 8068{ 8069'Subscript:0:2:[' , 8070children ={ 8071'PlainIdentifier(scope=0,ident=a):0:1:a' , 8072'PlainIdentifier(scope=0,ident=b):0:3:b' , 8073} , 8074} , 8075{ 8076'ListLiteral:0:6: [' , 8077children ={ 8078{ 8079'Comma:0:9:,' , 8080children ={ 8081'PlainIdentifier(scope=0,ident=c):0:8:c' , 8082{ 8083'ListLiteral:0:10: [' , 8084children ={ 8085{ 8086'Comma:0:13:,' , 8087children ={ 8088'PlainIdentifier(scope=0,ident=d):0:12:d' , 8089{ 8090'ListLiteral:0:14: [' , 8091children ={ 8092'PlainIdentifier(scope=0,ident=e):0:16:e' , 8093} , 8094} , 8095} , 8096} , 8097} , 8098} , 8099} , 8100} , 8101} , 8102} , 8103} , 8104} , 8105} , 8106} , 8107'Integer(val=1):0:23: 1' , 8108} , 8109} , 8110} , 8111err ={ 8112arg ='[c, [d, [e]]]] = 1' , 8113msg ='E475: Nested lists not allowed when assigning: %.*s' , 8114} , 8115} , { 8116hl ( 'List' , '[' ), 8117hl ( 'IdentifierName' , 'a' ), 8118hl ( 'SubscriptBracket' , '[' ), 8119hl ( 'IdentifierName' , 'b' ), 8120hl ( 'SubscriptBracket' , ']' ), 8121hl ( 'Comma' , ',' ), 8122hl ( 'InvalidList' , '[' , 1 ), 8123hl ( 'IdentifierName' , 'c' ), 8124hl ( 'Comma' , ',' ), 8125hl ( 'InvalidList' , '[' , 1 ), 8126hl ( 'IdentifierName' , 'd' ), 8127hl ( 'Comma' , ',' ), 8128hl ( 'InvalidList' , '[' , 1 ), 8129hl ( 'IdentifierName' , 'e' ), 8130hl ( 'List' , ']' ), 8131hl ( 'List' , ']' ), 8132hl ( 'List' , ']' ), 8133hl ( 'List' , ']' ), 8134hl ( 'PlainAssignment' , '=' , 1 ), 8135hl ( 'Number' , '1' , 1 ), 8136} ) 8137 8138check_asgn_parsing ( '$X += 1' , { 8139-- 0123456 8140ast ={ 8141{ 8142'Assignment(Add):0:2: +=' , 8143children ={ 8144'Environment(ident=X):0:0:$X' , 8145'Integer(val=1):0:5: 1' , 8146} , 8147} , 8148} , 8149} , { 8150hl ( 'EnvironmentSigil' , '$' ), 8151hl ( 'EnvironmentName' , 'X' ), 8152hl ( 'AssignmentWithAddition' , '+=' , 1 ), 8153hl ( 'Number' , '1' , 1 ), 8154} ) 8155 8156check_asgn_parsing ( '@a .= 1' , { 8157-- 0123456 8158ast ={ 8159{ 8160'Assignment(Concat):0:2: .=' , 8161children ={ 8162'Register(name=a):0:0:@a' , 8163'Integer(val=1):0:5: 1' , 8164} , 8165} , 8166} , 8167} , { 8168hl ( 'Register' , '@a' ), 8169hl ( 'AssignmentWithConcatenation' , '.=' , 1 ), 8170hl ( 'Number' , '1' , 1 ), 8171} ) 8172 8173check_asgn_parsing ( '&option -= 1' , { 8174-- 012345678901 8175-- 0 1 8176ast ={ 8177{ 8178'Assignment(Subtract):0:7: -=' , 8179children ={ 8180'Option(scope=0,ident=option):0:0:&option' , 8181'Integer(val=1):0:10: 1' , 8182} , 8183} , 8184} , 8185} , { 8186hl ( 'OptionSigil' , '&' ), 8187hl ( 'OptionName' , 'option' ), 8188hl ( 'AssignmentWithSubtraction' , '-=' , 1 ), 8189hl ( 'Number' , '1' , 1 ), 8190} ) 8191 8192check_asgn_parsing ( '[$X, @a, &l:option] = [1, 2, 3]' , { 8193-- 0123456789012345678901234567890 8194-- 0 1 2 3 8195ast ={ 8196{ 8197'Assignment(Plain):0:19: =' , 8198children ={ 8199{ 8200'ListLiteral:0:0:[' , 8201children ={ 8202{ 8203'Comma:0:3:,' , 8204children ={ 8205'Environment(ident=X):0:1:$X' , 8206{ 8207'Comma:0:7:,' , 8208children ={ 8209'Register(name=a):0:4: @a' , 8210'Option(scope=l,ident=option):0:8: &l:option' , 8211} , 8212} , 8213} , 8214} , 8215} , 8216} , 8217{ 8218'ListLiteral:0:21: [' , 8219children ={ 8220{ 8221'Comma:0:24:,' , 8222children ={ 8223'Integer(val=1):0:23:1' , 8224{ 8225'Comma:0:27:,' , 8226children ={ 8227'Integer(val=2):0:25: 2' , 8228'Integer(val=3):0:28: 3' , 8229} , 8230} , 8231} , 8232} , 8233} , 8234} , 8235} , 8236} , 8237} , 8238} , { 8239hl ( 'List' , '[' ), 8240hl ( 'EnvironmentSigil' , '$' ), 8241hl ( 'EnvironmentName' , 'X' ), 8242hl ( 'Comma' , ',' ), 8243hl ( 'Register' , '@a' , 1 ), 8244hl ( 'Comma' , ',' ), 8245hl ( 'OptionSigil' , '&' , 1 ), 8246hl ( 'OptionScope' , 'l' ), 8247hl ( 'OptionScopeDelimiter' , ':' ), 8248hl ( 'OptionName' , 'option' ), 8249hl ( 'List' , ']' ), 8250hl ( 'PlainAssignment' , '=' , 1 ), 8251hl ( 'List' , '[' , 1 ), 8252hl ( 'Number' , '1' ), 8253hl ( 'Comma' , ',' ), 8254hl ( 'Number' , '2' , 1 ), 8255hl ( 'Comma' , ',' ), 8256hl ( 'Number' , '3' , 1 ), 8257hl ( 'List' , ']' ), 8258} ) 8259end ) 8260itp ( 'works with non-ASCII characters' , function () 8261check_parsing ( '"«»"«»' , { 8262-- 013568 8263ast ={ 8264{ 8265'OpMissing:0:6:' , 8266children ={ 8267'DoubleQuotedString(val="«»"):0:0:"«»"' , 8268{ 8269'ComplexIdentifier:0:8:' , 8270children ={ 8271'PlainIdentifier(scope=0,ident=«):0:6:«' , 8272'PlainIdentifier(scope=0,ident=»):0:8:»' , 8273} , 8274} , 8275} , 8276} , 8277} , 8278err ={ 8279arg ='«»' , 8280msg ='E15: Unidentified character: %.*s' , 8281} , 8282} , { 8283hl ( 'DoubleQuote' , '"' ), 8284hl ( 'DoubleQuotedBody' , '«»' ), 8285hl ( 'DoubleQuote' , '"' ), 8286hl ( 'InvalidIdentifierName' , '«' ), 8287hl ( 'InvalidIdentifierName' , '»' ), 8288} , { 8289[ 1 ] ={ 8290ast ={ 8291ast ={ 8292'DoubleQuotedString(val="«»"):0:0:"«»"' , 8293} , 8294len =6 , 8295} , 8296hl_fs ={ 8297[ 5 ] =REMOVE_THIS , 8298[ 4 ] =REMOVE_THIS , 8299} , 8300} , 8301} ) 8302check_parsing ( '"\192"\192"foo"' , { 8303-- 01 23 45678 8304ast ={ 8305{ 8306'OpMissing:0:3:' , 8307children ={ 8308'DoubleQuotedString(val="\192"):0:0:"\192"' , 8309{ 8310'OpMissing:0:4:' , 8311children ={ 8312'PlainIdentifier(scope=0,ident=\192):0:3:\192' , 8313'DoubleQuotedString(val="foo"):0:4:"foo"' , 8314} , 8315} , 8316} , 8317} , 8318} , 8319err ={ 8320arg ='\192"foo"' , 8321msg ='E15: Unidentified character: %.*s' , 8322} , 8323} , { 8324hl ( 'DoubleQuote' , '"' ), 8325hl ( 'DoubleQuotedBody' , '\192' ), 8326hl ( 'DoubleQuote' , '"' ), 8327hl ( 'InvalidIdentifierName' , '\192' ), 8328hl ( 'InvalidDoubleQuote' , '"' ), 8329hl ( 'InvalidDoubleQuotedBody' , 'foo' ), 8330hl ( 'InvalidDoubleQuote' , '"' ), 8331} , { 8332[ 1 ] ={ 8333ast ={ 8334ast ={ 8335'DoubleQuotedString(val="\192"):0:0:"\192"' , 8336} , 8337len =3 , 8338} , 8339hl_fs ={ 8340[ 4 ] =REMOVE_THIS , 8341[ 5 ] =REMOVE_THIS , 8342[ 6 ] =REMOVE_THIS , 8343[ 7 ] =REMOVE_THIS , 8344} , 8345} , 8346} ) 8347end ) 8348end