ast

package
v0.0.0-...-ea60fba Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg struct {
	Name          tok.Token // tok.Ident or nil
	Value         Expr
	ValueFirstTok tok.Token
}

The Arg struct represents instantiation or type argument. ValueFirstTok token might be useful to get argument location when Name is nil.

type BinaryExpr

type BinaryExpr struct {
	X  Expr
	Op tok.Operator
	Y  Expr
}

Expression nodes

type BitString

type BitString struct {
	X tok.BitString
}

Expression nodes

type Body

type Body struct {
	Consts []Const
	Insts  []Inst
	Props  []Prop
	Types  []Type
}

The Body struct represents functionality body.

type Bool

type Bool struct {
	X tok.Bool
}

Expression nodes

type Call

type Call struct {
	Name tok.Ident
	Args []Expr
}

Function Call

type Const

type Const struct {
	Doc   Doc
	Name  tok.Ident
	Value Expr
}

The const struct represents constant.

type Doc

type Doc struct {
	Lines []tok.Comment
}

The Doc struct represents documentation comment.

func (Doc) Text

func (d Doc) Text(src []byte) string

type Expr

type Expr interface {
	// contains filtered or unexported methods
}

The Expr interface represents generic expression.

type File

type File struct {
	Imports []Import
	Consts  []Const
	Insts   []Inst
	Types   []Type
}

func Build

func Build(src []byte) (File, error)

Build builds ast from provided source.

type Ident

type Ident struct {
	Name tok.Token
}

Expression nodes

type Import

type Import struct {
	Name tok.Token // tok.Ident or nil
	Path tok.String
}

The import struct represents package import.

type Inst

type Inst struct {
	Doc   Doc
	Name  tok.Ident
	Count Expr      // If not nil, then it is a list
	Type  tok.Token // Basic type, identifier or qualified identifier
	Args  []Arg
	Body  Body
}

The Inst struct represents functionality instantiation.

type Int

type Int struct {
	X tok.Int
}

Expression nodes

type List

type List struct {
	Xs []Expr
}

Expression nodes

type Param

type Param struct {
	Name  tok.Ident
	Value Expr // Default value of the parameter
}

The Param struct represents type parameter.

type ParenExpr

type ParenExpr struct {
	X Expr
}

Expression nodes

type Prop

type Prop struct {
	Name  tok.Property
	Value Expr
}

The Prop struct represents functionality property.

type Real

type Real struct {
	X tok.Real
}

Expression nodes

type String

type String struct {
	X tok.String
}

Expression nodes

type Time

type Time struct {
	X tok.Time
}

Expression nodes

type Type

type Type struct {
	Doc    Doc
	Name   tok.Ident
	Params []Param
	Count  Expr      // If Count is not nil, then the type is a list
	Type   tok.Token // Basic type, identifier or qualified identifier
	Args   []Arg
	Body   Body
}

The Type struct represents type definition.

type UnaryExpr

type UnaryExpr struct {
	Op tok.Token
	X  Expr
}

Expression nodes

Jump to

Keyboard shortcuts

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