From b453a5c93d7ec305d1e664bb24eea2cc77ccc761 Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sun, 20 Jun 2021 02:52:06 +0900 Subject: Add syntax of comments --- spec/lexer_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'spec/lexer_test.go') diff --git a/spec/lexer_test.go b/spec/lexer_test.go index 1edf15c..484ad30 100644 --- a/spec/lexer_test.go +++ b/spec/lexer_test.go @@ -32,6 +32,21 @@ func TestLexer_Run(t *testing.T) { newEOFToken(), }, }, + { + caption: "the lexer ignores line comments", + src: ` +// This is the first comment. +foo +// This is the second comment. +// This is the third comment. +bar // This is the fourth comment. +`, + tokens: []*token{ + newIDToken("foo"), + newIDToken("bar"), + newEOFToken(), + }, + }, { caption: "an unclosed terminal is not a valid token", src: `"abc`, -- cgit v1.2.3