diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-08-28 00:18:19 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-08-28 00:18:51 +0900 |
commit | a769f496ecba60a73d74c445f5894ce52be800ee (patch) | |
tree | eeeb9b4040eee106fe18be8ac252651ef7eaaf4f /spec/lexer_test.go | |
parent | Add error symbol and #recover directive to recover from an error state (diff) | |
download | urubu-a769f496ecba60a73d74c445f5894ce52be800ee.tar.gz urubu-a769f496ecba60a73d74c445f5894ce52be800ee.tar.xz |
Add an #alias directive to define a user-friendly name of a terminal
Diffstat (limited to 'spec/lexer_test.go')
-rw-r--r-- | spec/lexer_test.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/spec/lexer_test.go b/spec/lexer_test.go index 51e5f59..c3540f6 100644 --- a/spec/lexer_test.go +++ b/spec/lexer_test.go @@ -16,6 +16,10 @@ func TestLexer_Run(t *testing.T) { return newTerminalPatternToken(text, newPosition(1, 0)) } + strTok := func(text string) *token { + return newStringLiteralToken(text, newPosition(1, 0)) + } + symTok := func(kind tokenKind) *token { return newSymbolToken(kind, newPosition(1, 0)) } @@ -40,7 +44,7 @@ func TestLexer_Run(t *testing.T) { tokens: []*token{ idTok("id"), termPatTok("terminal"), - termPatTok(`\.\*\+\?\|\(\)\[\\`), + strTok(`.*+?|()[\`), symTok(tokenKindColon), symTok(tokenKindOr), symTok(tokenKindSemicolon), |