parser

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2015 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrParserFail = errors.New("thrift.parser: parsing failed entirely")
)

Functions

This section is empty.

Types

type Constant

type Constant struct {
	Name  string
	Type  *Type
	Value interface{}
}

type Enum

type Enum struct {
	Name   string
	Values map[string]*EnumValue
}

type EnumValue

type EnumValue struct {
	Name  string
	Value int
}

type ErrSyntaxError

type ErrSyntaxError struct {
	File   string
	Line   int
	Column int
	Offset int
	Left   string
}

func (*ErrSyntaxError) Error

func (e *ErrSyntaxError) Error() string

type Field

type Field struct {
	Id       int
	Name     string
	Optional bool
	Type     *Type
	Default  interface{}
}

type Filesystem

type Filesystem interface {
	Open(filename string) (io.ReadCloser, error)
	Abs(path string) (string, error)
}

type Method

type Method struct {
	Comment    string
	Name       string
	Oneway     bool
	ReturnType *Type
	Arguments  []*Field
	Exceptions []*Field
}

type Parser

type Parser struct {
	Filesystem Filesystem // For handling includes. Can be set to nil to fall back to os package.
}

func (*Parser) Parse

func (p *Parser) Parse(r io.Reader) (*Thrift, error)

func (*Parser) ParseFile

func (p *Parser) ParseFile(filename string) (map[string]*Thrift, string, error)

type Service

type Service struct {
	Name    string
	Extends string
	Methods map[string]*Method
}

type Struct

type Struct struct {
	Name   string
	Fields []*Field
}

type Thrift

type Thrift struct {
	Includes   map[string]string // name -> unique identifier (absolute path generally)
	Typedefs   map[string]*Type
	Namespaces map[string]string
	Constants  map[string]*Constant
	Enums      map[string]*Enum
	Structs    map[string]*Struct
	Exceptions map[string]*Struct
	Services   map[string]*Service
}

type Type

type Type struct {
	Name      string
	KeyType   *Type // If map
	ValueType *Type // If map or list
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL