ast

package
v0.0.0-...-3085ebc Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Expression

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

type InfixExpression

type InfixExpression struct {
	Token    token.Token
	Operator string
	Right    Expression
	Left     Expression
}

1 + 2 * 3

func (*InfixExpression) End

func (ie *InfixExpression) End() token.Position

func (*InfixExpression) Pos

func (ie *InfixExpression) Pos() token.Position

func (*InfixExpression) String

func (ie *InfixExpression) String() string

func (*InfixExpression) TokenLiteral

func (ie *InfixExpression) TokenLiteral() string

type Node

type Node interface {
	Pos() token.Position // position of first character belonging to the node
	End() token.Position // position of first character immediately after the node

	TokenLiteral() string
	String() string
}

type NumberLiteral

type NumberLiteral struct {
	Token token.Token
	Value float64
}

func (*NumberLiteral) End

func (nl *NumberLiteral) End() token.Position

func (*NumberLiteral) Pos

func (nl *NumberLiteral) Pos() token.Position

func (*NumberLiteral) String

func (nl *NumberLiteral) String() string

func (*NumberLiteral) TokenLiteral

func (nl *NumberLiteral) TokenLiteral() string

type PrefixExpression

type PrefixExpression struct {
	Token    token.Token
	Operator string
	Right    Expression
}

-2, -3

func (*PrefixExpression) End

func (pe *PrefixExpression) End() token.Position

func (*PrefixExpression) Pos

func (pe *PrefixExpression) Pos() token.Position

func (*PrefixExpression) String

func (pe *PrefixExpression) String() string

func (*PrefixExpression) TokenLiteral

func (pe *PrefixExpression) TokenLiteral() string

type Program

type Program struct {
	Expression Expression
}

func (*Program) End

func (p *Program) End() token.Position

func (*Program) Pos

func (p *Program) Pos() token.Position

func (*Program) String

func (p *Program) String() string

func (*Program) TokenLiteral

func (p *Program) TokenLiteral() string

Jump to

Keyboard shortcuts

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