ast

package
v0.0.0-...-f469397 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package ast declares the types used to represent syntax trees for Gor packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadDecl

type BadDecl struct {
	From, To gotoken.Pos
}

BadDecl represents a declaration that couldn't be parsed.

type BadExpr

type BadExpr struct {
	From, To gotoken.Pos // position range of bad expression
}

A BadExpr node is a placeholder for an expression containing syntax errors for which a correct expression node cannot be created.

type BasicLit

type BasicLit struct {
	ValuePos gotoken.Pos // literal position
	Kind     token.Token // token.INT, token.FLOAT, token.IMAG, token.CHAR, or token.STRING
	Value    string      // literal string; e.g. 42, 0x7f, 3.14, 1e-9, 2.4i, 'a', '\x7f', "foo" or `\m\n\o`
}

A BasicLit node describes a basic literal.

type BinaryExpr

type BinaryExpr struct {
	X     Expr        // left operand
	OpPos gotoken.Pos // position of Op
	Op    token.Token // operator
	Y     Expr        // right operand
}

BinaryExpr represents an expression operating on two operands.

type Decl

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

Decl declaration node int the AST.

type Expr

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

Expr represents an expression.

type File

type File struct {
	Package gotoken.Pos
	Name    *Ident
	Decls   []Decl
}

File node in the AST.

type GenDecl

type GenDecl struct {
	TokPos gotoken.Pos // position of Tok
	Tok    token.Token // IMPORT, CONST, TYPE, or VAR
	Lparen gotoken.Pos // position of '(', if any
	Specs  []Spec
	Rparen gotoken.Pos // position of ')', if any
}

A GenDecl node (generic declaration node) represents an import, constant, type or variable declaration.

type Ident

type Ident struct {
	NamePos gotoken.Pos
	Name    string
}

Ident is an identifier.

type ImportSpec

type ImportSpec struct {
	Name *Ident    // local package name (including "."); or nil
	Path *BasicLit // import path
}

ImportSpec represents a node for an import declaration.

type Spec

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

The Spec type stands for any of *ImportSpec, *ValueSpec, and *TypeSpec.

type StarExpr

type StarExpr struct {
	X    Expr        // left operand
	Star gotoken.Pos // operator
}

StarExpr represents an expression with one operand.

type UnaryExpr

type UnaryExpr struct {
	X     Expr        // left operand
	OpPos gotoken.Pos // position of Op
	Op    token.Token // operator
}

UnaryExpr represents an expression with one operand.

type ValueSpec

type ValueSpec struct {
	Names  []*Ident // value names (len(Names) > 0)
	Type   Expr     // value type; or nil
	Values []Expr   // initial values; or nil
}

ValueSpec represents a node for a value declaration.

Jump to

Keyboard shortcuts

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