From db6d75ef557482a86d6b4881e4a3eb1098511124 Mon Sep 17 00:00:00 2001 From: marihachi Date: Thu, 16 Nov 2023 20:38:21 +0900 Subject: [PATCH] fix tail comment --- src/parser/scanner.ts | 1 - test/index.ts | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/parser/scanner.ts b/src/parser/scanner.ts index 21d42f28..c1b07983 100644 --- a/src/parser/scanner.ts +++ b/src/parser/scanner.ts @@ -582,7 +582,6 @@ export class Scanner implements ITokenStream { break; } if (this.stream.char === '\n') { - this.stream.next(); break; } this.stream.next(); diff --git a/test/index.ts b/test/index.ts index 7eb82f9b..2c28d4ac 100644 --- a/test/index.ts +++ b/test/index.ts @@ -341,6 +341,15 @@ describe('Comment', () => { const res = await exe('<: "//"'); eq(res, STR('//')); }); + + test.concurrent('line tail', async () => { + const res = await exe(` + let x = 'a' // comment + let y = 'b' + <: x + `); + eq(res, STR('a')); + }); }); test.concurrent('式にコロンがあってもオブジェクトと判定されない', async () => {