This repository was archived by the owner on Jul 24, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +66
-0
lines changed Expand file tree Collapse file tree 4 files changed +66
-0
lines changed Original file line number Diff line number Diff line change @@ -804,16 +804,20 @@ impl Lexer {
804804 }
805805 }
806806
807+ let mut leading_whitespace_buffer = Vec :: new ( ) ;
808+
807809 // If the type of whitespace is the same, we want to know
808810 // how much whitespace is on this line. We only care about
809811 // the smallest amount of whitespace in this case.
810812 loop {
811813 match ( current_indentation_type, state. peek_buf ( ) ) {
812814 ( DocStringIndentationType :: Space , [ b' ' , ..] ) => {
815+ leading_whitespace_buffer. push ( b' ' ) ;
813816 current_indentation_amount += 1 ;
814817 state. next ( ) ;
815818 } ,
816819 ( DocStringIndentationType :: Tab , [ b'\t' , ..] ) => {
820+ leading_whitespace_buffer. push ( b'\t' ) ;
817821 current_indentation_amount += 1 ;
818822 state. next ( ) ;
819823 } ,
@@ -863,6 +867,7 @@ impl Lexer {
863867 state. set ( StackFrame :: Scripting ) ?;
864868 break TokenKind :: EndDocString ( label, indentation_type, current_indentation_amount) ;
865869 } else {
870+ buffer. extend ( leading_whitespace_buffer) ;
866871 buffer. extend ( whitespace_buffer) ;
867872 continue ;
868873 }
Original file line number Diff line number Diff line change 1+ [
2+ Expression {
3+ expr: Nowdoc {
4+ value: " Hello, world!\n Hello, world!",
5+ },
6+ },
7+ ]
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ <<<'EOF'
4+ Hello, world!
5+ Hello, world!
6+ EOF;
Original file line number Diff line number Diff line change 1+ [
2+ Token {
3+ kind: OpenTag(
4+ Full,
5+ ),
6+ span: (
7+ 1,
8+ 1,
9+ ),
10+ },
11+ Token {
12+ kind: StartDocString(
13+ "EOF",
14+ Nowdoc,
15+ ),
16+ span: (
17+ 3,
18+ 1,
19+ ),
20+ },
21+ Token {
22+ kind: StringPart(
23+ " Hello, world!\n Hello, world!",
24+ ),
25+ span: (
26+ 4,
27+ 1,
28+ ),
29+ },
30+ Token {
31+ kind: EndDocString(
32+ "EOF",
33+ None,
34+ 0,
35+ ),
36+ span: (
37+ 4,
38+ 1,
39+ ),
40+ },
41+ Token {
42+ kind: SemiColon,
43+ span: (
44+ 6,
45+ 4,
46+ ),
47+ },
48+ ]
You can’t perform that action at this time.
0 commit comments