Commit 0cbfc85
committed
Fix string literals immediately followed by line continuation
Previously:
```f90
print*, 'this looks like implicit '&
'concatenation but isn''t'
print*, "this explicit concatenation "&
// "is intended"
```
would get parsed as
```
8:2 - 9:33 print_statement
8:2 - 8:7 "print"
8:7 - 8:8 format_identifier
8:7 - 8:8 "*"
8:8 - 8:9 ","
9:7 - 9:33 output_item_list
9:7 - 9:33 string_literal `'concatenation but isn''t'`
10:2 - 11:23 print_statement
10:2 - 10:7 "print"
10:7 - 10:8 format_identifier
10:7 - 10:8 "*"
10:8 - 10:9 ","
11:7 - 11:23 output_item_list
11:7 - 11:23 concatenation_expression
11:7 - 11:7 left: string_literal
11:7 - 11:9 "//"
11:10 - 11:23 right: string_literal `"is intended"`
```
Note first half of literal is missing!
Now gets parsed as:
```
8:2 - 9:33 print_statement
8:2 - 8:7 "print"
8:7 - 8:8 format_identifier
8:7 - 8:8 "*"
8:8 - 8:9 ","
8:10 - 9:33 output_item_list
8:10 - 9:33 string_literal
8:10 - 8:39 `'this looks like implicit '&\n`
9:10 - 9:33 ` 'concatenation but isn''t'`
10:2 - 11:23 print_statement
10:2 - 10:7 "print"
10:7 - 10:8 format_identifier
10:7 - 10:8 "*"
10:8 - 10:9 ","
10:10 - 11:23 output_item_list
10:10 - 11:23 concatenation_expression
10:10 - 10:40 left: string_literal `"this explicit concatenation "`
10:40 - 10:41 "&"
11:7 - 11:7 "&"
11:7 - 11:9 "//"
11:10 - 11:23 right: string_literal `"is intended"`
```
Full literal text is now included.
No tests because this is in the CST, and that's not captured in the tests1 parent 52a59d5 commit 0cbfc85
1 file changed
+5
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
| 368 | + | |
368 | 369 | | |
369 | 370 | | |
370 | 371 | | |
| |||
0 commit comments