Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TypeNames = []string{"string", "byte",
"uint8", "int8",
"uint16", "int16",
"uint32", "int32",
"uint64", "int64",
"float32", "float64", "timestamp",
"tuple", "int", "float", "bool",
}
Reserved Types
Functions ¶
func LoadDirectory ¶
LoadDirectory reads all the schema files from a directory.
Types ¶
type Config ¶
type Config struct {
PackageRootDir string
}
Config simply stores the parsing configuration.
type Field ¶
Field is the lowest level of granularity in a schema. Fields belong to a single Version within a Type. They are effectively immutable and should not be changed.
type Handler ¶
type Handler func(Token)
Handler is simpley a function which takes a single Token argument
type Lexer ¶
type Lexer struct { Name string // Used to error reports Start int // start position of this item Pos int // current position in the input Width int // width of last rune read // contains filtered or unexported fields }
Lexer holds the state of the scanner
type Package ¶
Package contains an entire schema document.
type PackageList ¶
PackageList is an interface for a package registry.
func NewPackageList ¶
func NewPackageList() PackageList
NewPackageList creates a new package registry
type SyntaxError ¶
type SyntaxError struct {
Message string
}
SyntaxError represents an error while parsing the schema
func (SyntaxError) Error ¶
func (s SyntaxError) Error() string
type Token ¶
type Token struct { Type TokenType // Type, such as itemNumber Value string // Value, such as "23.2" }
Token struct
type TokenType ¶
type TokenType uint8
TokenType enum
const ( TokenError TokenType = iota // 0 Lexer Error TokenEOF // 1 End of File TokenComment // 2 Comment TokenTypeDef // 3 Type keyword TokenVersion // 4 Version keyword TokenValueType // 5 Value type ID (string, uint8) TokenRequired // 6 Required Keyword TokenOptional // 7 Optional Keyword TokenVersionNumber // 8 Version ID TokenOpenCurlyBracket // 9 Left { TokenCloseCurlyBracket // 10 Right } TokenOpenArrayBracket // 11 Open Array [ TokenCloseArrayBracket // 12 Close Array ] TokenIdentifier // 13 Message or Field Name TokenComma // 14 Comma TokenPeriod // 15 Period TokenImport // 16 Import keyword TokenFrom // 17 From keyword TokenAs // 18 As keyword TokenPackage // 19 Package keyword TokenPackageName // 20 Package name TokenAsterisk // 21 Package all )
Lex items
Click to show internal directories.
Click to hide internal directories.