parser

package
v0.0.0-...-c984d99 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2013 License: BSD-3-Clause 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
	IncludeName string
}

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)
}

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, filename, includename string) (*Thrift, error)

func (*Parser) ParseFile

func (p *Parser) ParseFile(filename, includename string) (*Thrift, error)

type Service

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

type Struct

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

type Thrift

type Thrift struct {
	Includes   map[string]*Thrift
	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
}

func (*Thrift) MergeIncludes

func (t *Thrift) MergeIncludes() *Thrift

Generate a combined Thrift struct with includes merged into the namespace

type Type

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

Jump to

Keyboard shortcuts

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