Fixed issue with skipping newlines

This commit is contained in:
Ben Ashton 2022-09-04 23:36:32 -06:00
parent 8b1efa29c4
commit edc4bf3db5

View File

@ -72,12 +72,12 @@ export class TokenStream {
return flushRaw() || this._readInlineStatementUnescaped(); return flushRaw() || this._readInlineStatementUnescaped();
} else if ( } else if (
this._cs.column === 0 && this._cs.column === 0 &&
this._cs.peekAfter(this._isWhitespace) === TokenStream.STATEMENT this._cs.peekAfter(this._isSpace) === TokenStream.STATEMENT
) { ) {
return flushRaw() || this._readStatement(); return flushRaw() || this._readStatement();
} else if ( } else if (
this._cs.column === 0 && this._cs.column === 0 &&
this._cs.peekAfter(this._isWhitespace) === TokenStream.COMMENT this._cs.peekAfter(this._isSpace) === TokenStream.COMMENT
) { ) {
return flushRaw() || this._readComment(); return flushRaw() || this._readComment();
} else { } else {
@ -169,7 +169,7 @@ export class TokenStream {
_readFullLineGeneric(tokenType, tag) { _readFullLineGeneric(tokenType, tag) {
// Skip whitespace // Skip whitespace
this._cs.nextWhile(this._isWhitespace); this._cs.nextWhile(this._isSpace);
// Skip tag // Skip tag
this._cs.next(tag.length); this._cs.next(tag.length);
@ -206,7 +206,7 @@ export class TokenStream {
} }
// Utility methods // Utility methods
_isWhitespace(c) { _isSpace(c) {
return /\s/.test(c); return /^\S\r\n/.test(c);
} }
} }