tlschema

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2017 License: MIT Imports: 10 Imported by: 8

Documentation

Index

Constants

View Source
const (
	PriorityNormal       Priority = 0
	PriorityJustADefault          = -10
	PriorityOverride              = 10
)
View Source
const Natural = "#"

Variables

View Source
var ErrWeirdDef = errors.New("this line is best ignored")

Functions

func ParseLine

func ParseLine(line string, state ParseState) (*Def, ParseState, error)

func ToGoName

func ToGoName(s string) string

Types

type Alterations

type Alterations struct {
	Renamings map[string]string
}

type Arg

type Arg struct {
	Name string
	Type TypeExpr

	CondArgName string
	CondBit     int
}

func (*Arg) Alter

func (a *Arg) Alter(alter *Alterations)

func (Arg) CanonicalString

func (a Arg) CanonicalString() string

func (Arg) String

func (a Arg) String() string

type Comb

type Comb struct {
	*Def
	TypeStr string

	Origin   string
	Priority Priority
}

func (*Comb) FullName

func (c *Comb) FullName() string

type Def

type Def struct {
	Tag      uint32
	CombName ScopedName

	IsFunc     bool
	IsInternal bool

	IsQuestionMark bool
	IsWeird        bool

	OriginalStr string

	GenericArgs []Arg
	Args        []Arg

	ResultType TypeExpr
}

func Parse

func Parse(text string) ([]*Def, error)

func (*Def) Alter

func (d *Def) Alter(alter *Alterations)

func (Def) CanonicalString

func (d Def) CanonicalString() string

func (*Def) FixTag

func (d *Def) FixTag() error

func (*Def) Simplify

func (d *Def) Simplify() error

func (Def) String

func (d Def) String() string

type ParseOptions

type ParseOptions struct {
	Origin   string
	Priority Priority

	FixZeroTags   bool
	FixZeroTagsIn map[string]bool
	AllowZeroTags bool

	MarkInternal bool

	Alterations *Alterations
}

type ParseState

type ParseState struct {
	InsideFuncs bool
}

type Priority

type Priority int

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

func MustParse

func MustParse(text string) *Schema

func (*Schema) ByName

func (sch *Schema) ByName(name string) *Comb

func (*Schema) ByTag

func (sch *Schema) ByTag(tag uint32) *Comb

func (*Schema) Combs

func (sch *Schema) Combs() []*Comb

func (*Schema) Funcs

func (sch *Schema) Funcs() []*Comb

func (*Schema) Parse

func (sch *Schema) Parse(text string, options ParseOptions) error

func (*Schema) Type

func (sch *Schema) Type(name string) *Type

func (*Schema) Types

func (sch *Schema) Types() []*Type

type ScopedName

type ScopedName struct {
	// contains filtered or unexported fields
}

func MakeScopedName

func MakeScopedName(s string) ScopedName

func MakeScopedNameComponents

func MakeScopedNameComponents(scope, short string) ScopedName

func (*ScopedName) Alter

func (n *ScopedName) Alter(alter *Alterations)

func (ScopedName) Full

func (n ScopedName) Full() string

func (ScopedName) GoName

func (n ScopedName) GoName() string

func (ScopedName) HasScope

func (n ScopedName) HasScope() bool

func (ScopedName) IsBare

func (n ScopedName) IsBare() bool

func (ScopedName) Scope

func (n ScopedName) Scope() string

func (ScopedName) Short

func (n ScopedName) Short() string

func (ScopedName) String

func (n ScopedName) String() string

type Type

type Type struct {
	Name  ScopedName
	Ctors []*Comb

	Origin   string
	Priority Priority
}

func (*Type) String

func (t *Type) String() string

type TypeExpr

type TypeExpr struct {
	IsBang      bool
	IsPercent   bool
	Name        ScopedName
	GenericArgs []TypeExpr
}

func (*TypeExpr) Alter

func (t *TypeExpr) Alter(alter *Alterations)

func (TypeExpr) CanonicalString

func (t TypeExpr) CanonicalString() string

func (TypeExpr) IsBare

func (t TypeExpr) IsBare() bool

func (TypeExpr) IsJustTypeName

func (t TypeExpr) IsJustTypeName() bool

func (*TypeExpr) Simplify

func (t *TypeExpr) Simplify(genericTypeNames []string)

func (TypeExpr) String

func (t TypeExpr) String() string

Jump to

Keyboard shortcuts

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