ast

package
v0.0.0-...-11c8b56 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2018 License: AGPL-3.0 Imports: 3 Imported by: 6

Documentation

Overview

Package ast describes an abstract syntax tree for PQL

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AST

type AST struct {
	Query     ExpressionStatement
	Modifiers []ModifierStatement
}

AST is the parsed abstract syntax tree of a query

func (AST) String

func (a AST) String() string

type DateLiteral

type DateLiteral struct {
	Token token.Token
	Value time.Time
}

DateLiteral is a string representing a date

func (DateLiteral) GetValue

func (dl DateLiteral) GetValue() interface{}

Value impelements literal

func (DateLiteral) String

func (dl DateLiteral) String() string

func (DateLiteral) TokenLiteral

func (dl DateLiteral) TokenLiteral() string

TokenLiteral implements AST node

type Expression

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

Expression represents an AST node that evaluates to a value

type ExpressionStatement

type ExpressionStatement struct {
	Token      token.Token
	Expression Expression
}

ExpressionStatement is the root node of a query

func (*ExpressionStatement) String

func (es *ExpressionStatement) String() string

func (*ExpressionStatement) TokenLiteral

func (es *ExpressionStatement) TokenLiteral() string

TokenLiteral implements AST node

type FieldLiteral

type FieldLiteral struct {
	Token token.Token
	Value string
}

FieldLiteral is a field name either a custom field or otherwise

func (FieldLiteral) GetValue

func (fl FieldLiteral) GetValue() string

GetValue implements literal

func (FieldLiteral) IsCustomField

func (fl FieldLiteral) IsCustomField() bool

IsCustomField will return whether or not the given field is a custom field

func (FieldLiteral) String

func (fl FieldLiteral) String() string

func (FieldLiteral) TokenLiteral

func (fl FieldLiteral) TokenLiteral() string

TokenLiteral implements AST node

type InfixExpression

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

InfixExpression is an expression with a left and right side, as well as an operator to perform on those sides

func (InfixExpression) String

func (ie InfixExpression) String() string

func (InfixExpression) TokenLiteral

func (ie InfixExpression) TokenLiteral() string

TokenLiteral implements AST node

type IntegerLiteral

type IntegerLiteral struct {
	Token token.Token
	Value int64
}

IntegerLiteral is a node whose value is an Integer

func (IntegerLiteral) GetValue

func (il IntegerLiteral) GetValue() interface{}

func (IntegerLiteral) String

func (il IntegerLiteral) String() string

func (IntegerLiteral) TokenLiteral

func (il IntegerLiteral) TokenLiteral() string

TokenLiteral implements AST node

type Literal

type Literal interface {
	GetValue() interface{}
}

Literal is any literal value

type ModifierStatement

type ModifierStatement struct {
	Token    token.Token
	Modifier string
	Value    Expression
}

ModifierStatement is a statement which modifies the behavior of a query, i.e. LIMIT or ORDER BY

func (*ModifierStatement) String

func (es *ModifierStatement) String() string

func (*ModifierStatement) TokenLiteral

func (es *ModifierStatement) TokenLiteral() string

TokenLiteral implements AST node

type Node

type Node interface {
	TokenLiteral() string
	String() string
}

Node is implemented by all nodes in the AST

type Statement

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

Statement represents an AST node that performs some action

type StringLiteral

type StringLiteral struct {
	Token token.Token
	Value string
}

func (StringLiteral) GetValue

func (sl StringLiteral) GetValue() interface{}

Value impelements literal

func (StringLiteral) String

func (sl StringLiteral) String() string

func (StringLiteral) TokenLiteral

func (sl StringLiteral) TokenLiteral() string

TokenLiteral implements AST node

Jump to

Keyboard shortcuts

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