File tree 4 files changed +8
-15
lines changed 4 files changed +8
-15
lines changed Original file line number Diff line number Diff line change 3
3
4
4
## Unreleased
5
5
6
- - …
7
-
6
+ - Remove support for CR as a line ending. (#154 )
8
7
9
8
## 0.6.0 (July 24, 2018)
10
9
Original file line number Diff line number Diff line change @@ -98,7 +98,6 @@ digit ::= [0-9]
98
98
inline_space ::= (" \u0020" | " \u0009" )+
99
99
line_end ::= " \u000D\u000A"
100
100
| " \u000A"
101
- | " \u000D"
102
101
| EOF
103
102
blank_line ::= inline_space ? line_end
104
103
break_indent ::= line_end blank_line * inline_space
Original file line number Diff line number Diff line change @@ -86,20 +86,16 @@ export function into(Type) {
86
86
case FTL . GroupComment :
87
87
case FTL . ResourceComment :
88
88
return content => {
89
- if ( content . endsWith ( "\n" ) ) {
90
- if ( content . endsWith ( "\r\n" ) ) {
91
- var offset = - 2 ;
92
- } else {
93
- var offset = - 1 ;
94
- }
95
- } else if ( content . endsWith ( "\r" ) ) {
96
- var offset = - 1 ;
97
- } else {
89
+ if ( ! content . endsWith ( "\n" ) ) {
98
90
// The comment ended with the EOF; don't trim it.
99
91
return always ( new Type ( content ) ) ;
100
92
}
101
- // Trim the EOL from the end of the comment.
102
- return always ( new Type ( content . slice ( 0 , offset ) ) ) ;
93
+ if ( content . endsWith ( "\r\n" ) ) {
94
+ // Trim the CRLF from the end of the comment.
95
+ return always ( new Type ( content . slice ( 0 , - 2 ) ) ) ;
96
+ }
97
+ // Trim the LF from the end of the comment.
98
+ return always ( new Type ( content . slice ( 0 , - 1 ) ) ) ;
103
99
} ;
104
100
case FTL . Placeable :
105
101
return expression => {
Original file line number Diff line number Diff line change @@ -467,7 +467,6 @@ let line_end =
467
467
either (
468
468
string ( "\u000D\u000A" ) ,
469
469
string ( "\u000A" ) ,
470
- string ( "\u000D" ) ,
471
470
eof ( ) ) ;
472
471
473
472
let blank_line =
You can’t perform that action at this time.
0 commit comments