diff --git a/src/token_stream.mjs b/src/token_stream.mjs index cf29413..4318979 100644 --- a/src/token_stream.mjs +++ b/src/token_stream.mjs @@ -2,6 +2,7 @@ import { CharacterStream } from './character_stream.mjs'; import { TemplateSyntaxError } from './errors/template_syntax_error.mjs'; export class TokenStream { + static ESCAPE = '\\'; static OPEN_INLINE = '<%'; static CLOSE_INLINE = '%>'; static OPEN_INLINE_UNESCAPED = ' /\S/.test(c)); } else if (this._cs.isNext(TokenStream.OPEN_INLINE)) { return flushRaw() || this._readInline(); } else if (this._cs.isNext(TokenStream.OPEN_INLINE_UNESCAPED)) { @@ -174,13 +180,13 @@ export class TokenStream { // Skip tag this._cs.next(tag.length); - // Check for mandatory space - if (this._cs.peek() !== ' ') { + // Check for mandatory space/tab/new line + if (this._isSpace(this._cs.peek())) { + // Consume space + this._cs.next(); + } else if (/[^\r\n]/.test(this._cs.peek())) { this._missingFullLineSpaceError(tag); } - - // Consume space - this._cs.next(); // Remainder of line is value const value = this._cs.nextWhile((c) => c !== '\n');