parser

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CombinatorDeclaration

type CombinatorDeclaration struct {
	Constructor      string       `@Ident`
	Tag              string       `@HexTag?`
	FieldDefinitions []NamedField `@@*`
	Equal            string       `"="`
	Combinator       string       `@Ident`
	End              string       `";"`
}

type DefaultType

type DefaultType struct {
	Name          string
	IsPointerType bool
}

type Generator

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

func NewGenerator

func NewGenerator(knownTypes map[string]DefaultType, typeName string) *Generator

func (*Generator) LoadFunctions

func (g *Generator) LoadFunctions(functions []CombinatorDeclaration) (string, error)

func (*Generator) LoadTypes

func (g *Generator) LoadTypes(declarations []CombinatorDeclaration) (string, error)

type Modificator

type Modificator struct {
	Name string `@Ident "."`
	Bit  string `@NUMBER "?"`
}

type NamedField

type NamedField struct {
	Name        string         `@Ident`
	Sep         string         `":"`
	Modificator Modificator    `@@?`
	Expression  TypeExpression `@@`
}

type ParenExpression

type ParenExpression struct {
	Name      string           `"(" @Ident `
	Parameter []TypeExpression `@@* ")"`
}

type TL

type TL struct {
	Declarations []CombinatorDeclaration `@@*`
	Separator    string                  `FunctionsSeparator`
	Functions    []CombinatorDeclaration "@@*"
}

func Parse

func Parse(tl string) (*TL, error)

type TypeExpression

type TypeExpression struct {
	BuiltIn  *string          `@BuiltIn`
	NamedRef *string          `| @Ident`
	Vector   *ParenExpression `| @@`
}

func (TypeExpression) String

func (t TypeExpression) String() string

Jump to

Keyboard shortcuts

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