@@ -249,6 +249,95 @@ Program {
249
249
}
250
250
` ;
251
251
252
+ exports [` heredoc Flexible heredoc syntax: empty lines 2` ] = `
253
+ Program {
254
+ " children" : Array [
255
+ ExpressionStatement {
256
+ " expression" : Assign {
257
+ " kind" : " assign" ,
258
+ " left" : Variable {
259
+ " curly" : false ,
260
+ " kind" : " variable" ,
261
+ " name" : " values" ,
262
+ },
263
+ " operator" : " =" ,
264
+ " right" : Array {
265
+ " items" : Array [
266
+ Entry {
267
+ " byRef" : false ,
268
+ " key" : null ,
269
+ " kind" : " entry" ,
270
+ " unpack" : false ,
271
+ " value" : Encapsed {
272
+ " kind" : " encapsed" ,
273
+ " label" : " END" ,
274
+ " raw" : " <<<END
275
+ a
276
+
277
+ b
278
+
279
+ c
280
+
281
+ END ];
282
+ " ,
283
+ " type" : " heredoc" ,
284
+ " value" : Array [
285
+ EncapsedPart {
286
+ " curly" : false ,
287
+ " expression" : String {
288
+ " isDoubleQuote" : false ,
289
+ " kind" : " string" ,
290
+ " raw" : " a
291
+
292
+ b
293
+
294
+ c
295
+
296
+ END ];
297
+ " ,
298
+ " unicode" : false ,
299
+ " value" : " a
300
+
301
+ b
302
+
303
+ c
304
+
305
+ END ];" ,
306
+ },
307
+ " kind" : " encapsedpart" ,
308
+ " syntax" : null ,
309
+ },
310
+ ],
311
+ },
312
+ },
313
+ ],
314
+ " kind" : " array" ,
315
+ " shortForm" : true ,
316
+ },
317
+ },
318
+ " kind" : " expressionstatement" ,
319
+ },
320
+ ],
321
+ " errors" : Array [
322
+ Error {
323
+ " expected" : 220 ,
324
+ " kind" : " error" ,
325
+ " line" : 10 ,
326
+ " message" : " Parse Error : syntax error, expecting T_END_HEREDOC on line 10" ,
327
+ " token" : " the end of file (EOF)" ,
328
+ },
329
+ Error {
330
+ " expected" : " ]" ,
331
+ " kind" : " error" ,
332
+ " line" : 10 ,
333
+ " message" : " Parse Error : syntax error, expecting ']' on line 10" ,
334
+ " token" : " the end of file (EOF)" ,
335
+ },
336
+ ],
337
+ " kind" : " program" ,
338
+ }
339
+ ` ;
340
+
252
341
exports [` heredoc Flexible heredoc syntax: mixing spaces and tabs in body 1` ] = `
253
342
Program {
254
343
" children" : Array [
@@ -374,6 +463,75 @@ END",
374
463
}
375
464
` ;
376
465
466
+ exports [` heredoc Flexible heredoc syntax: parentheses 2` ] = `
467
+ Program {
468
+ " children" : Array [
469
+ ExpressionStatement {
470
+ " expression" : Call {
471
+ " arguments" : Array [
472
+ Encapsed {
473
+ " kind" : " encapsed" ,
474
+ " label" : " END" ,
475
+ " raw" : " <<<END
476
+ a
477
+ b
478
+ c
479
+ END );
480
+ " ,
481
+ " type" : " heredoc" ,
482
+ " value" : Array [
483
+ EncapsedPart {
484
+ " curly" : false ,
485
+ " expression" : String {
486
+ " isDoubleQuote" : false ,
487
+ " kind" : " string" ,
488
+ " raw" : " a
489
+ b
490
+ c
491
+ END );
492
+ " ,
493
+ " unicode" : false ,
494
+ " value" : " a
495
+ b
496
+ c
497
+ END );" ,
498
+ },
499
+ " kind" : " encapsedpart" ,
500
+ " syntax" : null ,
501
+ },
502
+ ],
503
+ },
504
+ ],
505
+ " kind" : " call" ,
506
+ " what" : Name {
507
+ " kind" : " name" ,
508
+ " name" : " stringManipulator" ,
509
+ " resolution" : " uqn" ,
510
+ },
511
+ },
512
+ " kind" : " expressionstatement" ,
513
+ },
514
+ ],
515
+ " errors" : Array [
516
+ Error {
517
+ " expected" : 220 ,
518
+ " kind" : " error" ,
519
+ " line" : 7 ,
520
+ " message" : " Parse Error : syntax error, expecting T_END_HEREDOC on line 7" ,
521
+ " token" : " the end of file (EOF)" ,
522
+ },
523
+ Error {
524
+ " expected" : " )" ,
525
+ " kind" : " error" ,
526
+ " line" : 7 ,
527
+ " message" : " Parse Error : syntax error, expecting ')' on line 7" ,
528
+ " token" : " the end of file (EOF)" ,
529
+ },
530
+ ],
531
+ " kind" : " program" ,
532
+ }
533
+ ` ;
534
+
377
535
exports [` heredoc Flexible heredoc syntax: symbols after ending 1` ] = `
378
536
Program {
379
537
" children" : Array [
449
607
}
450
608
` ;
451
609
610
+ exports [` heredoc Flexible heredoc syntax: symbols after ending 2` ] = `
611
+ Program {
612
+ " children" : Array [
613
+ ExpressionStatement {
614
+ " expression" : Assign {
615
+ " kind" : " assign" ,
616
+ " left" : Variable {
617
+ " curly" : false ,
618
+ " kind" : " variable" ,
619
+ " name" : " values" ,
620
+ },
621
+ " operator" : " =" ,
622
+ " right" : Array {
623
+ " items" : Array [
624
+ Entry {
625
+ " byRef" : false ,
626
+ " key" : null ,
627
+ " kind" : " entry" ,
628
+ " unpack" : false ,
629
+ " value" : Encapsed {
630
+ " kind" : " encapsed" ,
631
+ " label" : " END" ,
632
+ " raw" : " <<<END
633
+ a
634
+ b
635
+ c
636
+ END , 'd e f'];
637
+ ",
638
+ " type" : " heredoc" ,
639
+ " value" : Array [
640
+ EncapsedPart {
641
+ " curly" : false ,
642
+ " expression" : String {
643
+ " isDoubleQuote" : false ,
644
+ " kind" : " string" ,
645
+ " raw" : " a
646
+ b
647
+ c
648
+ END , 'd e f'];
649
+ ",
650
+ " unicode" : false ,
651
+ " value" : " a
652
+ b
653
+ c
654
+ END , 'd e f'];",
655
+ },
656
+ " kind" : " encapsedpart" ,
657
+ " syntax" : null ,
658
+ },
659
+ ],
660
+ },
661
+ },
662
+ ],
663
+ " kind" : " array" ,
664
+ " shortForm" : true ,
665
+ },
666
+ },
667
+ " kind" : " expressionstatement" ,
668
+ },
669
+ ],
670
+ " errors" : Array [
671
+ Error {
672
+ " expected" : 220 ,
673
+ " kind" : " error" ,
674
+ " line" : 7 ,
675
+ " message" : " Parse Error : syntax error, expecting T_END_HEREDOC on line 7" ,
676
+ " token" : " the end of file (EOF)" ,
677
+ },
678
+ Error {
679
+ " expected" : " ]" ,
680
+ " kind" : " error" ,
681
+ " line" : 7 ,
682
+ " message" : " Parse Error : syntax error, expecting ']' on line 7" ,
683
+ " token" : " the end of file (EOF)" ,
684
+ },
685
+ ],
686
+ " kind" : " program" ,
687
+ }
688
+ ` ;
689
+
452
690
exports [` heredoc Flexible heredoc syntax: symbols after ending with whitespace 1` ] = `
453
691
Program {
454
692
" children" : Array [
524
762
}
525
763
` ;
526
764
765
+ exports [` heredoc Flexible heredoc syntax: symbols after ending with whitespace 2` ] = `
766
+ Program {
767
+ " children" : Array [
768
+ ExpressionStatement {
769
+ " expression" : Assign {
770
+ " kind" : " assign" ,
771
+ " left" : Variable {
772
+ " curly" : false ,
773
+ " kind" : " variable" ,
774
+ " name" : " values" ,
775
+ },
776
+ " operator" : " =" ,
777
+ " right" : Array {
778
+ " items" : Array [
779
+ Entry {
780
+ " byRef" : false ,
781
+ " key" : null ,
782
+ " kind" : " entry" ,
783
+ " unpack" : false ,
784
+ " value" : Encapsed {
785
+ " kind" : " encapsed" ,
786
+ " label" : " END" ,
787
+ " raw" : " <<<END
788
+ a
789
+ b
790
+ c
791
+ END , 'd e f'];
792
+ ",
793
+ " type" : " heredoc" ,
794
+ " value" : Array [
795
+ EncapsedPart {
796
+ " curly" : false ,
797
+ " expression" : String {
798
+ " isDoubleQuote" : false ,
799
+ " kind" : " string" ,
800
+ " raw" : " a
801
+ b
802
+ c
803
+ END , 'd e f'];
804
+ ",
805
+ " unicode" : false ,
806
+ " value" : " a
807
+ b
808
+ c
809
+ END , 'd e f'];",
810
+ },
811
+ " kind" : " encapsedpart" ,
812
+ " syntax" : null ,
813
+ },
814
+ ],
815
+ },
816
+ },
817
+ ],
818
+ " kind" : " array" ,
819
+ " shortForm" : true ,
820
+ },
821
+ },
822
+ " kind" : " expressionstatement" ,
823
+ },
824
+ ],
825
+ " errors" : Array [
826
+ Error {
827
+ " expected" : 220 ,
828
+ " kind" : " error" ,
829
+ " line" : 7 ,
830
+ " message" : " Parse Error : syntax error, expecting T_END_HEREDOC on line 7" ,
831
+ " token" : " the end of file (EOF)" ,
832
+ },
833
+ Error {
834
+ " expected" : " ]" ,
835
+ " kind" : " error" ,
836
+ " line" : 7 ,
837
+ " message" : " Parse Error : syntax error, expecting ']' on line 7" ,
838
+ " token" : " the end of file (EOF)" ,
839
+ },
840
+ ],
841
+ " kind" : " program" ,
842
+ }
843
+ ` ;
844
+
527
845
exports [` heredoc Flexible heredoc syntax: with variables 1` ] = `
528
846
Program {
529
847
" children" : Array [
0 commit comments