aboutsummaryrefslogtreecommitdiff
path: root/spec/lexer_test.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-08-28 00:18:19 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-08-28 00:18:51 +0900
commita769f496ecba60a73d74c445f5894ce52be800ee (patch)
treeeeeb9b4040eee106fe18be8ac252651ef7eaaf4f /spec/lexer_test.go
parentAdd error symbol and #recover directive to recover from an error state (diff)
downloadcotia-a769f496ecba60a73d74c445f5894ce52be800ee.tar.gz
cotia-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.go6
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),