File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,17 @@ struct DietInput
127127 Token [] backlog;
128128 bool lastWasNewline = true ;
129129
130+ size_t indexEOL () @property const
131+ {
132+ string pre = read([0 , index]);
133+ if (pre.endsWith(" \r\n " ))
134+ return index - 2 ;
135+ else if (pre.endsWith(" \r " , " \n " ))
136+ return index - 1 ;
137+ else
138+ return index;
139+ }
140+
130141 static DietInput fromFile (R)(R file)
131142 {
132143 import std.file : readText;
@@ -165,7 +176,7 @@ struct DietInput
165176 return indentation;
166177 }
167178
168- string read (size_t [2 ] range)
179+ string read (size_t [2 ] range) const
169180 {
170181 if (range[1 ] < range[0 ])
171182 return null ;
Original file line number Diff line number Diff line change @@ -1351,7 +1351,7 @@ struct ASTParser
13511351 ret._contents = parseTagContents();
13521352 }
13531353
1354- ret._token.range[1 ] = input.index ;
1354+ ret._token.range[1 ] = input.indexEOL ;
13551355 return ret;
13561356 }
13571357 else
@@ -1378,7 +1378,7 @@ struct ASTParser
13781378 input.expect(TokenType.detent);
13791379 }
13801380 }
1381- front.range[1 ] = input.index ;
1381+ front.range[1 ] = input.indexEOL ;
13821382 return new StringTagContents(front, content);
13831383 }
13841384 return null ;
You can’t perform that action at this time.
0 commit comments