ast

package
v0.0.0-...-1adbf8b Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindAnyParent

func FindAnyParent(e antlr.Tree, types []string) antlr.Tree

FindAnyParent returns the closest parent RuleContext matching any of the given types.

func FindChild

func FindChild(e antlr.Tree, typ string) antlr.Tree

FindChild performs a depth-first search traversal and returns the first child of a certain type.

func FindParent

func FindParent(e antlr.Tree, t reflect.Type) antlr.Tree

FindParent returns the closest parent RuleContext matching a certain type. If the Tree is of type t, it is returned directly.

func GetParent

func GetParent(e antlr.Tree) antlr.Tree

GetParent returns the parent RuleContext in the ParseTree.

func HasErrorNode

func HasErrorNode(e antlr.Tree) bool

HasErrorNode checks whether the given ParseTree contains an ErrorNode.

Types

type Pos

type Pos interface {
	// GetStart returns the position where the Token begins.
	GetStart() int
	// GetStop returns the position where the Token ends.
	GetStop() int
}

Pos provides the position of Tokens in a ParseTree.

func GetPosition

func GetPosition(el antlr.Tree) Pos

GetPosition returns the position of the given Token or Symbol.

Jump to

Keyboard shortcuts

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