| @@ -195,9 +195,10 @@ | ||
| 195 | 195 | |
| 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; |
| 203 | 204 | $this->lastByteOut = $this->a; |
| @@ -205,9 +206,11 @@ | ||
| 205 | 206 | $this->a = $this->get(); |
| 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 JSMin_UnterminatedStringException( |
| 212 | 215 | "JSMin: Unterminated String at byte {$byte}: {$str}"); |
| 213 | 216 | } |
| @@ -215,9 +218,9 @@ | ||
| 215 | 218 | if ($this->a === '\\') { |
| 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 | } |
| 223 | 226 | } |
| @@ -328,9 +331,9 @@ | ||
| 328 | 331 | if ($this->inputIndex < $this->inputLength) { |
| 329 | 332 | $c = $this->input[$this->inputIndex]; |
| 330 | 333 | $this->inputIndex += 1; |
| 331 | 334 | } else { |
| 332 | - $c = null; | |
| 335 | + return $c; | |
| 333 | 336 | } |
| 334 | 337 | } |
| 335 | 338 | if (ord($c) >= self::ORD_SPACE || $c === "\n" || $c === null) { |
| 336 | 339 | return $c; |