ast

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

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

Go to latest
Published: May 1, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BodyOneOf

type BodyOneOf string
const (
	BodyVoid     BodyOneOf = ""
	BodyString   BodyOneOf = "string"
	BodyRational BodyOneOf = "rational"
	BodyBool     BodyOneOf = "bool"
	BodyStruct   BodyOneOf = "struct"
	BodyType     BodyOneOf = "type"
)

type Comment

type Comment struct {
	Text string   `json:"Text,omitempty"`
	Tags NodeList `json:"Tags,omitempty"`
}

func (Comment) IsEmpty

func (t Comment) IsEmpty() bool

type Ident

type Ident struct {
	// Name of node relative to scope, for example: Name
	Name string
	// Scope of node relative to package, for example Ident
	Scope string
	// Filename relative to package directory, for example: ident.go
	Filename string
	// Package path relative to module, for example: pipe4/ast
	Package string
	// Module
	Module *Module
	// ImportURI
	ImportURI string
}

func (Ident) MarshalJSON

func (i Ident) MarshalJSON() ([]byte, error)

func (*Ident) Normalize

func (i *Ident) Normalize()

func (*Ident) UnmarshalJSON

func (i *Ident) UnmarshalJSON(value []byte) error

type Meta

type Meta struct {
	Filename string
	Position PositionRange
}

type Module

type Module struct {
	// URI that exactly identify module, for example: github.com/pipe4/lang
	URI     string
	Version Version
}

type Node

type Node struct {
	Ident   Ident
	Comment Comment

	Type    Type
	Default Type
}

func (Node) MarshalJSON

func (t Node) MarshalJSON() ([]byte, error)

func (*Node) UnmarshalJSON

func (t *Node) UnmarshalJSON(data []byte) error

type NodeList

type NodeList []Node

func (*NodeList) FromYaml

func (l *NodeList) FromYaml(source string) error

func (NodeList) Get

func (l NodeList) Get(name string) (Node, bool)

func (NodeList) GetString

func (l NodeList) GetString(name string) string

func (NodeList) ToYaml

func (l NodeList) ToYaml() (string, error)

type Position

type Position struct {
	Row int
	Col int
}

type PositionRange

type PositionRange struct {
	From Position
	To   Position
}

type Rational

type Rational struct {
	big.Rat
}

func (Rational) Equal

func (r Rational) Equal(other Rational) bool

func (Rational) IsZero

func (r Rational) IsZero() bool

type Type

type Type struct {
	Ident Ident
	Args  NodeList

	BodyOneOf BodyOneOf
	String    string
	Rational  Rational
	Bool      bool
	Struct    NodeList
	Type      *Type
}

func (Type) IsEmpty

func (t Type) IsEmpty() bool

func (Type) MarshalJSON

func (t Type) MarshalJSON() ([]byte, error)

func (*Type) SetBool

func (t *Type) SetBool(value bool)

func (*Type) SetRational

func (t *Type) SetRational(value big.Rat)

func (*Type) SetString

func (t *Type) SetString(value string)

func (*Type) UnmarshalJSON

func (t *Type) UnmarshalJSON(data []byte) error

type Version

type Version struct {
	Major int
	Minor int
	Patch int

	Ref  string
	Tags []string

	Hash crypto.Hash
	Sum  string
}

Jump to

Keyboard shortcuts

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