File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,8 @@ protected function action($command)
196
196
// fallthrough intentional
197
197
case self ::ACTION_DELETE_A : // 2
198
198
$ this ->a = $ this ->b ;
199
- if ($ this ->a === "' " || $ this ->a === '" ' ) { // string literal
199
+ if ($ this ->a === "' " || $ this ->a === '" ' || $ this ->a === '` ' ) { // string/template literal
200
+ $ delimiter = $ this ->a ;
200
201
$ str = $ this ->a ; // in case needed for exception
201
202
for (;;) {
202
203
$ this ->output .= $ this ->a ;
@@ -206,7 +207,9 @@ protected function action($command)
206
207
if ($ this ->a === $ this ->b ) { // end quote
207
208
break ;
208
209
}
209
- if ($ this ->isEOF ($ this ->a )) {
210
+ if ($ delimiter === '` ' && $ this ->a === "\n" ) {
211
+ // leave the newline
212
+ } elseif ($ this ->isEOF ($ this ->a )) {
210
213
$ byte = $ this ->inputIndex - 1 ;
211
214
throw new UnterminatedStringException (
212
215
"JSMin: Unterminated String at byte {$ byte }: {$ str }" );
@@ -216,7 +219,7 @@ protected function action($command)
216
219
$ this ->output .= $ this ->a ;
217
220
$ this ->lastByteOut = $ this ->a ;
218
221
219
- $ this ->a = $ this ->get ();
222
+ $ this ->a = $ this ->get ();
220
223
$ str .= $ this ->a ;
221
224
}
222
225
}
Original file line number Diff line number Diff line change
1
+ `line
2
+ break` + `he llo` ; foo `hel( '');lo` ; `he\nl\`lo` ; ( `he${ one + two } ` )
Original file line number Diff line number Diff line change
1
+ `line
2
+ break` + `he llo` ; foo `hel( '');lo` ; `he\nl\`lo` ; ( `he${ one + two } ` )
You can’t perform that action at this time.
0 commit comments