ast

package
v0.0.0-...-8ba896d Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accept

func Accept(node Node, v Visitor)

func AcceptInterfaceMember

func AcceptInterfaceMember(m InterfaceMember, v Visitor)

func AcceptLiteral

func AcceptLiteral(in Literal, v Visitor)

func AcceptMixinMember

func AcceptMixinMember(m MixinMember, v Visitor)

Types

type Annotation

type Annotation struct {
	Base
	Name       string
	Value      string       // [A=B]
	Parameters []*Parameter // [A(X x, Y y)]
	Values     []string     // [A=(a,b,c)]
}

[Constructor], []

type AnyType

type AnyType struct {
	Base
}

type Base

type Base struct {
	Start    int // rune
	End      int // rune
	Line     int // line number
	Comments []string
	Errors   []*ErrorNode
}

func (*Base) NodeBase

func (b *Base) NodeBase() *Base

type BasicLiteral

type BasicLiteral struct {
	Base
	Value string
}

type Callback

type Callback struct {
	Base
	Name       string
	Return     Type
	Parameters []*Parameter
}

type CustomOp

type CustomOp struct {
	Base
	Name string
}

type Decl

type Decl interface {
	Node
	// contains filtered or unexported methods
}

type DefaultDictionaryLiteral

type DefaultDictionaryLiteral struct {
	Base
}

type Dictionary

type Dictionary struct {
	Base
	Name        string
	Inherits    string
	Partial     bool
	Annotations []*Annotation
	Members     []*Member
}

type EmptyVisitor

type EmptyVisitor struct {
	UseFlags             bool
	ScanBase             bool
	ScanErrorNode        bool
	ScanFile             bool
	ScanInterface        bool
	ScanMixin            bool
	ScanDictionary       bool
	ScanAnnotation       bool
	ScanParameter        bool
	ScanImplementation   bool
	ScanIncludes         bool
	ScanMember           bool
	ScanCustomOp         bool
	ScanTypeName         bool
	ScanPattern          bool
	ScanCallback         bool
	ScanEnum             bool
	ScanTypedef          bool
	ScanAnyType          bool
	ScanSequenceType     bool
	ScanRecordType       bool
	ScanParametrizedType bool
	ScanUnionType        bool
	ScanNullableType     bool
	ScanBasicLiteral     bool
	ScanSequenceLiteral  bool
}

EmptyVisitor implement a default Visitor that is doing nothing

func (*EmptyVisitor) Annotation

func (t *EmptyVisitor) Annotation(value *Annotation) bool

func (*EmptyVisitor) AnyType

func (t *EmptyVisitor) AnyType(value *AnyType)

func (*EmptyVisitor) Base

func (t *EmptyVisitor) Base(base *Base)

func (*EmptyVisitor) BasicLiteral

func (t *EmptyVisitor) BasicLiteral(value *BasicLiteral)

func (*EmptyVisitor) Callback

func (t *EmptyVisitor) Callback(value *Callback) bool

func (*EmptyVisitor) CustomOp

func (t *EmptyVisitor) CustomOp(value *CustomOp)

func (*EmptyVisitor) Dictionary

func (t *EmptyVisitor) Dictionary(value *Dictionary) bool

func (*EmptyVisitor) Enum

func (t *EmptyVisitor) Enum(value *Enum) bool

func (*EmptyVisitor) ErrorNode

func (t *EmptyVisitor) ErrorNode(value *ErrorNode)

func (*EmptyVisitor) File

func (t *EmptyVisitor) File(value *File) bool

func (*EmptyVisitor) Implementation

func (t *EmptyVisitor) Implementation(value *Implementation)

func (*EmptyVisitor) Includes

func (t *EmptyVisitor) Includes(value *Includes)

func (*EmptyVisitor) Interface

func (t *EmptyVisitor) Interface(value *Interface) bool

func (*EmptyVisitor) Member

func (t *EmptyVisitor) Member(value *Member) bool

func (*EmptyVisitor) Mixin

func (t *EmptyVisitor) Mixin(value *Mixin) bool

func (*EmptyVisitor) NullableType

func (t *EmptyVisitor) NullableType(value *NullableType) bool

func (*EmptyVisitor) Parameter

func (t *EmptyVisitor) Parameter(value *Parameter) bool

func (*EmptyVisitor) ParametrizedType

func (t *EmptyVisitor) ParametrizedType(value *ParametrizedType) bool

func (*EmptyVisitor) Pattern

func (t *EmptyVisitor) Pattern(value *Pattern)

func (*EmptyVisitor) RecordType

func (t *EmptyVisitor) RecordType(value *RecordType) bool

func (*EmptyVisitor) SequenceLiteral

func (t *EmptyVisitor) SequenceLiteral(value *SequenceLiteral) bool

func (*EmptyVisitor) SequenceType

func (t *EmptyVisitor) SequenceType(value *SequenceType) bool

func (*EmptyVisitor) TypeName

func (t *EmptyVisitor) TypeName(value *TypeName)

func (*EmptyVisitor) Typedef

func (t *EmptyVisitor) Typedef(value *Typedef) bool

func (*EmptyVisitor) UnionType

func (t *EmptyVisitor) UnionType(value *UnionType) bool

type Enum

type Enum struct {
	Base
	Annotations []*Annotation
	Name        string
	Values      []Literal
}

type ErrorNode

type ErrorNode struct {
	Base
	Message string
}

error occurred; value is text of error

func GetAllErrorNodes

func GetAllErrorNodes(start Node) []*ErrorNode

type File

type File struct {
	Base
	Declarations []Decl
}

The file root node

type Implementation

type Implementation struct {
	Base
	Name   string
	Source string
}

Window implements ECMA262Globals

type Includes

type Includes struct {
	Base
	Name   string
	Source string
}

Document includes DocumentOrShadowRoot

type Interface

type Interface struct {
	Base
	Partial     bool
	Callback    bool
	Name        string
	Inherits    string
	Annotations []*Annotation
	Members     []InterfaceMember
	CustomOps   []*CustomOp
	Patterns    []*Pattern
}

interface Foo { ... }

type InterfaceMember

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

type Literal

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

type Member

type Member struct {
	Base
	Name           string
	Type           Type
	Init           Literal
	Attribute      bool
	Static         bool
	Const          bool
	Readonly       bool
	Required       bool
	Specialization string
	Parameters     []*Parameter
	Annotations    []*Annotation
}

readonly attribute something

type Mixin

type Mixin struct {
	Base
	Name        string
	Inherits    string
	Partial     bool
	Annotations []*Annotation
	Members     []MixinMember
	CustomOps   []*CustomOp
	Patterns    []*Pattern
}

interface mixin Foo { ... }

type MixinMember

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

type Namespace

type Namespace struct {
	Base
	Partial     bool
	Name        string
	Annotations []*Annotation
	Members     []InterfaceMember
}

namespace Foo { ... }

type NamespaceMember

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

type Node

type Node interface {
	NodeBase() *Base
}

type NullableType

type NullableType struct {
	Base
	Type Type
}

type Parameter

type Parameter struct {
	Base
	Type        Type
	Optional    bool
	Variadic    bool
	Name        string
	Init        Literal
	Annotations []*Annotation
}

optional any SomeArg

type ParametrizedType

type ParametrizedType struct {
	Base
	Name  string
	Elems []Type
}

type Pattern

type Pattern struct {
	Base
	Type     PatternType
	Key      Type
	Elem     Type
	ReadOnly bool
}

type PatternType

type PatternType int
const (
	Iterable PatternType = iota + 1
	AsyncIterable
	Maplike
	Setlike
)

type RecordType

type RecordType struct {
	Base
	Key  Type
	Elem Type
}

type SequenceLiteral

type SequenceLiteral struct {
	Base
	Elems []Literal
}

type SequenceType

type SequenceType struct {
	Base
	Elem Type
}

type Type

type Type interface {
	Node
	// contains filtered or unexported methods
}

type TypeName

type TypeName struct {
	Base
	Name string
}

type Typedef

type Typedef struct {
	Base
	Annotations     []*Annotation
	TypeAnnotations []*Annotation
	Name            string
	Type            Type
}

type UnionType

type UnionType struct {
	Base
	Types []Type
}

type Visitor

type Visitor interface {
	Base(base *Base)

	ErrorNode(value *ErrorNode)
	File(value *File) bool
	Interface(value *Interface) bool
	Mixin(value *Mixin) bool
	Dictionary(value *Dictionary) bool
	Annotation(value *Annotation) bool
	Parameter(value *Parameter) bool
	Implementation(value *Implementation)
	Includes(value *Includes)
	Member(value *Member) bool
	CustomOp(value *CustomOp)
	TypeName(value *TypeName)
	Pattern(value *Pattern)
	Callback(value *Callback) bool
	Enum(value *Enum) bool
	Typedef(value *Typedef) bool
	AnyType(value *AnyType)
	SequenceType(value *SequenceType) bool
	RecordType(value *RecordType) bool
	ParametrizedType(value *ParametrizedType) bool
	UnionType(value *UnionType) bool
	NullableType(value *NullableType) bool
	BasicLiteral(value *BasicLiteral)
	SequenceLiteral(value *SequenceLiteral) bool
}

Jump to

Keyboard shortcuts

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