Documentation ¶
Index ¶
- func Parse(filename string, b []byte, opts ...Option) (interface{}, error)
- func ParseFile(filename string, opts ...Option) (interface{}, error)
- func ParseReader(filename string, r io.Reader, opts ...Option) (interface{}, error)
- type Annotation
- type Constant
- type Enum
- type EnumValue
- type Field
- type Filesystem
- type Identifier
- type KeyValue
- type Method
- type Option
- type Parser
- type Pos
- type Service
- type Struct
- type Thrift
- type Type
- type Typedef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Annotation ¶
type EnumValue ¶
type EnumValue struct { Pos Pos Comment string Name string Value int Annotations []*Annotation `json:",omitempty"` }
type Filesystem ¶
type Identifier ¶
type Identifier string
type Option ¶
type Option func(*parser) Option
Option is a function that can set an option on the parser. It returns the previous setting as an Option.
func Debug ¶
Debug creates an Option to set the debug flag to b. When set to true, debugging information is printed to stdout while parsing.
The default is false.
func Memoize ¶
Memoize creates an Option to set the memoize flag to b. When set to true, the parser will cache all results so each expression is evaluated only once. This guarantees linear parsing time even for pathological cases, at the expense of more memory and slower times for typical cases.
The default is false.
type Parser ¶
type Parser struct { Filesystem Filesystem // For handling includes. Can be set to nil to fall back to os package. Files map[string]*Thrift }
type Struct ¶
type Struct struct { Pos Pos Comment string Name string Fields []*Field Annotations []*Annotation `json:",omitempty"` }
type Thrift ¶
type Thrift struct { Filename string Includes map[string]string `json:",omitempty"` // name -> unique identifier (absolute path generally) Imports map[string]*Thrift `json:",omitempty"` // name -> imported file Typedefs map[string]*Typedef `json:",omitempty"` Namespaces map[string]string `json:",omitempty"` Constants map[string]*Constant `json:",omitempty"` Enums map[string]*Enum `json:",omitempty"` Structs map[string]*Struct `json:",omitempty"` Exceptions map[string]*Struct `json:",omitempty"` Unions map[string]*Struct `json:",omitempty"` Services map[string]*Service `json:",omitempty"` }
Click to show internal directories.
Click to hide internal directories.