-
Notifications
You must be signed in to change notification settings - Fork 0
/
lex.go
28 lines (25 loc) · 1.11 KB
/
lex.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package xlsy
import (
"github.com/viant/parsly"
"github.com/viant/parsly/matcher"
)
const (
whitespaceToken = iota
comaTerminatorToken
semicolonTerminatorToken
colonTerminatorToken
equalTerminatorToken
scopeBlockToken
singleQuotedToken
numberToken
)
var (
numberMatcher = parsly.NewToken(numberToken, "Number", matcher.NewNumber())
whitespaceMatcher = parsly.NewToken(whitespaceToken, "Whitespace", matcher.NewWhiteSpace())
comaTerminatorMatcher = parsly.NewToken(comaTerminatorToken, "coma", matcher.NewTerminator(',', true))
equalTerminatorMatcher = parsly.NewToken(equalTerminatorToken, "=", matcher.NewTerminator('=', true))
colonTerminatorMatcher = parsly.NewToken(colonTerminatorToken, "colon", matcher.NewTerminator(':', true))
semicolonTerminatorMatcher = parsly.NewToken(semicolonTerminatorToken, "semicolon", matcher.NewTerminator(';', true))
scopeBlockMatcher = parsly.NewToken(scopeBlockToken, "{ .... }", matcher.NewBlock('{', '}', '\\'))
singleQuotedMatcher = parsly.NewToken(singleQuotedToken, "single quoted block", matcher.NewQuote('\'', '\''))
)