parser

package
v0.0.0-...-9fc4353 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Dimensions []ArrayDimension `parser:"']' | ((@@ (',' @@)*) ']')"`
}

type ArrayDimension

type ArrayDimension struct {
	Name   *string
	Length *uint64
}

func (*ArrayDimension) Parse

func (a *ArrayDimension) Parse(lex *lexer.PeekingLexer) error

type Pattern

type Pattern struct {
	Discard  bool    `parser:"  @'_'"`
	Type     *Type   `parser:"| (@@"`
	Variable *string `parser:"   @Ident?)"`
}

func ParsePattern

func ParsePattern(input string) (*Pattern, error)

type Type

type Type struct {
	Pos   lexer.Position
	Named *TypeName  `parser:"(@@"`
	Sub   *Type      `parser:" | '(' @@ ')')"`
	Tails []TypeTail `parser:"@@*"`
}

func ParseType

func ParseType(input string) (*Type, error)

func (Type) String

func (t Type) String() string

type TypeName

type TypeName struct {
	Pos      lexer.Position
	Name     string  `parser:"@Ident @('.' Ident)*"`
	TypeArgs []*Type `parser:"('<' @@ (',' @@)* '>')?"`
}

func (TypeName) String

func (n TypeName) String() string

type TypeTail

type TypeTail struct {
	Optional bool    `parser:"  @'?'"`
	MapValue *Type   `parser:"| '-' '>' @@"`
	Vector   *Vector `parser:"| '*' @@"`
	Array    *Array  `parser:"| '[' @@"`
}

func (TypeTail) String

func (t TypeTail) String(target string) string

type Vector

type Vector struct {
	Length *uint64 `parser:"@Int?"`
}

Jump to

Keyboard shortcuts

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