ast

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

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

Go to latest
Published: Apr 12, 2016 License: LGPL-3.0, BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSet

type FileSet struct {
	// contains filtered or unexported fields
}

FileSet holds positioning information for parsed twik code.

func NewFileSet

func NewFileSet() *FileSet

NewFileSet returns a new FileSet.

func (*FileSet) PosInfo

func (fset *FileSet) PosInfo(pos Pos) *PosInfo

PosInfo returns the line and column for pos, and the name the file containing that position was parsed with.

type Float

type Float struct {
	Input    string
	InputPos Pos
	Value    float64
}

Float represents a float literal in parsed twik code.

func (*Float) End

func (l *Float) End() Pos

func (*Float) Pos

func (l *Float) Pos() Pos

type Int

type Int struct {
	Input    string
	InputPos Pos
	Value    int64
}

Int represents an integer literal in parsed twik code.

func (*Int) End

func (l *Int) End() Pos

func (*Int) Pos

func (l *Int) Pos() Pos

type List

type List struct {
	LParens Pos
	RParens Pos
	Nodes   []Node
}

List represents a list of entries from parsed twik code.

func (*List) End

func (s *List) End() Pos

func (*List) Pos

func (s *List) Pos() Pos

type Node

type Node interface {
	Pos() Pos
	End() Pos
}

The Node interface is implemented by all AST nodes that result from parsing twik code.

func Parse

func Parse(fset *FileSet, name string, code []byte) (Node, error)

Parse parses a byte slice containing twik code and returns the resulting parsed tree.

Positioning information for the parsed code will be stored in fset under the given name.

func ParseString

func ParseString(fset *FileSet, name string, code string) (Node, error)

ParseString parses a string containing twik code and returns the resulting parsed tree.

Positioning information for the parsed code will be stored in fset under the given name.

type Pos

type Pos int

Pos is a position marker within a file set. Use the FileSet's PosInfo method to obtain human-oriented details for the position.

type PosInfo

type PosInfo struct {
	Name   string
	Line   int
	Column int
}

PosInfo holds human-oriented positioning details about a Pos.

func (*PosInfo) String

func (info *PosInfo) String() string

type Root

type Root struct {
	First Pos
	After Pos
	Nodes []Node
}

Root represents the root of parsed twik code.

func (*Root) End

func (s *Root) End() Pos

func (*Root) Pos

func (s *Root) Pos() Pos

type String

type String struct {
	Input    string
	InputPos Pos
	Value    string
}

String represents a string literal in parsed twik code.

func (*String) End

func (l *String) End() Pos

func (*String) Pos

func (l *String) Pos() Pos

type Symbol

type Symbol struct {
	Name    string
	NamePos Pos
}

Symbol represents a symbol in parsed twik code.

func (*Symbol) End

func (s *Symbol) End() Pos

func (*Symbol) Pos

func (s *Symbol) Pos() Pos

Jump to

Keyboard shortcuts

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