summaryrefslogtreecommitdiff
path: root/conf/scanner.go
diff options
context:
space:
mode:
Diffstat (limited to 'conf/scanner.go')
-rw-r--r--conf/scanner.go26
1 files changed, 20 insertions, 6 deletions
diff --git a/conf/scanner.go b/conf/scanner.go
index 74e66e8..975a8e4 100644
--- a/conf/scanner.go
+++ b/conf/scanner.go
@@ -14,14 +14,24 @@ type tokentype int
const (
Name tokentype = iota
Literal
- ListDelimiter
- ObjectDelimiter
+ ListOpen
+ ListClose
+ ObjectOpen
+ ObjectClose
EmptyList
EmptyObject
Nothing
IfStatement
)
+var tokentypestrings []string = []string{Name: "Name", Literal: "Literal",
+ ListOpen: "List Open", ListClose: "List Close", ObjectOpen: "Object Open",
+ ObjectClose: "Object Close", Nothing: "Nothing", IfStatement: "If statement"}
+
+func (tt tokentype) String() string {
+ return tokentypestrings[tt]
+}
+
type token struct {
Type tokentype
Offset int
@@ -57,10 +67,14 @@ func getTokenType(s []byte) tokentype {
switch s[0] {
case '"', '\'':
return Literal
- case '[', ']':
- return ListDelimiter
- case '{', '}':
- return ObjectDelimiter
+ case '[':
+ return ListOpen
+ case ']':
+ return ListClose
+ case '{':
+ return ObjectOpen
+ case '}':
+ return ObjectClose
}
return Name