all repos

json2go @ main

convert json to go type annotations

json2go/token.go (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
refactor: use an actual parser instead of reflection..., 11 days ago
1
package json2go
2
3
type TokenType int
4
5
type Token struct {
6
	Type    TokenType
7
	Literal string
8
}
9
10
//go:generate go tool stringer -output token_type_string.go -type=TokenType
11
const (
12
	EOF TokenType = iota
13
	ILLEGAL
14
15
	NEWLINE // \n
16
	INDENT  // leading whitespace
17
18
	NUMBER  // 420
19
	DECIMAL // 69.420
20
	STRING  // "quote string"
21
	BOOL    // "true" "false"
22
	NULL    // "null"
23
24
	COLON    // :
25
	COMMA    // ,
26
	LBRACE   // {
27
	RBRACE   // }
28
	LBRACKET // [
29
	RBRACKET // ]
30
31
	COMMENTLINE  // // ...
32
	COMMENTBLOCK // /* ... */
33
)