ast

package
v1.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package ast provides available ast nodes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NodeKey

func NodeKey(n Node) string

NodeKey tries to return the node key

func NodeValue

func NodeValue(n Node) interface{}

NodeValue tries to return the node key

Types

type Ast

type Ast struct {
	*Base
	Nodes []Node `json:"body"`
}

Ast represents the query - node structure as abstract syntax tree

type Base

type Base struct {
	Loc *Location
}

Base contains shared node attributes each node should inherit from this

func (*Base) Location

func (b *Base) Location() *Location

Location is the source location of the Node

type BooleanNode

type BooleanNode struct {
	*Base
	Key   string
	Value bool
}

BooleanNode represents a bool value

type DateTimeNode

type DateTimeNode struct {
	*Base
	Key      string
	Operator *OperatorNode
	Value    time.Time
}

DateTimeNode represents a time.Time value

type GroupNode

type GroupNode struct {
	*Base
	Key   string
	Nodes []Node
}

GroupNode represents a collection of many grouped nodes

type Location

type Location struct {
	Start  Position `json:"start"`
	End    Position `json:"end"`
	Source *string  `json:"source,omitempty"`
}

Location represents the location of a node in the AST

type Node

type Node interface {
	Location() *Location
}

Node represents abstract syntax tree node

type OperatorNode

type OperatorNode struct {
	*Base
	Value string
}

OperatorNode represents an operator value like AND, OR, NOT, =, <= ... and so on

type Position

type Position struct {
	Line   int
	Column int
}

Position represents a specific location in the source

type StringNode

type StringNode struct {
	*Base
	Key   string
	Value string
}

StringNode represents a string value

Directories

Path Synopsis
Package test provides shared test primitives for ast testing.
Package test provides shared test primitives for ast testing.

Jump to

Keyboard shortcuts

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