Help us shape the future of Go! Take the 2026 Go Developer Survey

parser

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Def

type Def interface {
	String() string
	ShortType() string
	// ArgType indicates argument type
	ArgType() (types.FuncDefArgType, error)
	Optional() bool
	// TODO RetType indicates return type
	// This should be replaced with TypeDerivation method. Currently it just returns concrete type
	RetType() (types.Type, error)
}

type Expression

type Expression interface {
	String() string
}

type IntegerLiteral

type IntegerLiteral struct {
	Value int32 `parser:"@Int"`
}

func (*IntegerLiteral) String

func (l *IntegerLiteral) String() string

type ParamName

type ParamName struct {
	Name string `parser:"@Identifier"`
}

func (*ParamName) String

func (p *ParamName) String() string

type Parser

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

func New

func New() (*Parser, error)

func (*Parser) Parse

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

func (*Parser) ParseBytes

func (p *Parser) ParseBytes(expr []byte) (*TypeExpression, error)

func (*Parser) ParseString

func (p *Parser) ParseString(str string) (*TypeExpression, error)

type Type

type Type struct {
	TypeDef Def `parser:"@@"`
}

func (*Type) ArgType added in v1.0.0

func (t *Type) ArgType() (types.FuncDefArgType, error)

func (*Type) Optional

func (t *Type) Optional() bool

func (*Type) RetType added in v1.0.0

func (t *Type) RetType() (types.Type, error)

func (*Type) ShortType

func (t *Type) ShortType() string

func (*Type) String

func (t *Type) String() string

type TypeExpression

type TypeExpression struct {
	Expr Expression `parser:"@@"`
}

func (TypeExpression) MarshalYAML

func (t TypeExpression) MarshalYAML() (interface{}, error)

func (TypeExpression) String

func (t TypeExpression) String() string

func (TypeExpression) Type added in v1.0.0

func (*TypeExpression) UnmarshalYAML

func (t *TypeExpression) UnmarshalYAML(fn func(interface{}) error) error

Jump to

Keyboard shortcuts

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