Commit 33a5ad4
committed
Normalize line ending to
This matches the specification of multi-line string literal handling:
From https://docs.swift.org/swift-book/documentation/the-swift-programming-language/lexicalstructure/#String-Literals:
> Line breaks in a multiline string literal are normalized to use the line feed character. Even if your source file has a mix of carriage returns and line feeds, all of the line breaks in the string will be the same.
From https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170417/035923.html:
> The quoted string should normalize newlines to \n in the value of the literal, regardless of whether the source file uses \n (Unix), \r\n (Windows), or \r (classic Mac) line endings. Likewise, when the compiler strips the initial and final newline from the literal value, it will strip one of any of the \n, \r\n, or \r line-ending sequences from both ends of the literal.\n in StringLiteralExprSyntax.representedLiteralValue
1 parent e3ea968 commit 33a5ad4
File tree
2 files changed
+15
-3
lines changed- Sources/SwiftParser
- Lexer
2 files changed
+15
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1594 | 1594 | | |
1595 | 1595 | | |
1596 | 1596 | | |
1597 | | - | |
| 1597 | + | |
1598 | 1598 | | |
1599 | 1599 | | |
1600 | 1600 | | |
| |||
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
| 86 | + | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
108 | 120 | | |
109 | 121 | | |
110 | 122 | | |
| |||
0 commit comments