rsql

package
v0.12.17 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: MIT Imports: 6 Imported by: 5

Documentation

Index

Constants

View Source
const (
	PrecedenceLowest
	PrecedenceAND
	PrecedenceOR
	PrecedenceCompare
	PrecedenceHighest
)

Precidence enumerations

View Source
const (
	TokIllegal = "TokIllegal"
	TokEOF     = "TokEOF"

	TokIdent   = "TokIdent"
	TokInteger = "TokInteger"
	TokString  = "TokString"
	TokFloat   = "TokFloat"
	TokExtend  = "TokExtend"

	TokLParen = "("
	TokRParen = ")"

	TokLBracket = "["
	TokRBracket = "]"

	TokLIKE  = "~"
	TokNLIKE = "!~"
	TokNOT   = "!"
	TokLT    = "<"
	TokGT    = ">"
	TokLE    = "<="
	TokGE    = ">="
	TokEQ    = "=="
	TokNEQ   = "!="
	TokAND   = ";"
	TokOR    = ","

	TokTRUE  = "true"
	TokFALSE = "false"
	TokNULL  = "null"
)

Tokens for RSQL FIQL

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Token    Token
	Elements []Expression
}

Array is an array of tokens

func (*Array) String

func (a *Array) String() string

String returns a string representation of value

func (*Array) TokenLiteral

func (a *Array) TokenLiteral() string

TokenLiteral returns the literal value of a token

type Bool

type Bool struct {
	Token Token
	Value bool
}

Bool is a boolean value

func (*Bool) String

func (i *Bool) String() string

String returns a string representation of value

func (*Bool) TokenLiteral

func (i *Bool) TokenLiteral() string

TokenLiteral returns the literal value of a token

type Expression

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

Expression is a portion of tree

type ExpressionStatement

type ExpressionStatement struct {
	Token      Token
	Expression Expression
}

ExpressionStatement is a collection of expressions

func (ExpressionStatement) String

func (e ExpressionStatement) String() string

String returns a string representation of value

func (ExpressionStatement) TokenLiteral

func (e ExpressionStatement) TokenLiteral() string

TokenLiteral returns the literal value of a token

type Float

type Float struct {
	Token Token
	Value float64
}

Float is a floating point value

func (*Float) String

func (i *Float) String() string

String returns a string representation of value

func (*Float) TokenLiteral

func (i *Float) TokenLiteral() string

TokenLiteral returns the literal value of a token

type Identifier

type Identifier struct {
	Token Token
	Value string
}

Identifier is a variable name

func (*Identifier) String

func (i *Identifier) String() string

String returns a string representation of value

func (*Identifier) TokenLiteral

func (i *Identifier) TokenLiteral() string

TokenLiteral returns the literal value of a token

type InfixExpression

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

InfixExpression is two expressions with a infix operator

func (*InfixExpression) String

func (i *InfixExpression) String() string

String returns a string representation of value

func (*InfixExpression) TokenLiteral

func (i *InfixExpression) TokenLiteral() string

TokenLiteral returns the literal value of a token

type Integer

type Integer struct {
	Token Token
	Value int64
}

Integer is a numeric value

func (*Integer) String

func (i *Integer) String() string

String returns a string representation of value

func (*Integer) TokenLiteral

func (i *Integer) TokenLiteral() string

TokenLiteral returns the literal value of a token

type Lexer

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

Lexer reads tokens from input

func NewLexer

func NewLexer(in string) *Lexer

NewLexer returns a new lexing generator

func (*Lexer) NextToken

func (l *Lexer) NextToken() Token

NextToken returns the next token from lexer

type Node

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

Node is the smallest unit of ast

type Null

type Null struct {
	Token Token
}

Null is an empty value

func (*Null) String

func (i *Null) String() string

String returns a string representation of value

func (*Null) TokenLiteral

func (i *Null) TokenLiteral() string

TokenLiteral returns the literal value of a token

type Parser

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

Parser reads lexed values and builds an AST

func NewParser

func NewParser(l *Lexer) *Parser

NewParser returns a parser for a given lexer

func (*Parser) Errors

func (p *Parser) Errors() []string

Errors returns a list of errors while parsing

func (*Parser) ParseProgram

func (p *Parser) ParseProgram() *Program

ParseProgram builds a program AST from lexer

type PrefixExpression

type PrefixExpression struct {
	Token    Token
	Operator string
	Right    Expression
}

PrefixExpression is an expression with a preceeding operator

func (*PrefixExpression) String

func (p *PrefixExpression) String() string

String returns a string representation of value

func (*PrefixExpression) TokenLiteral

func (p *PrefixExpression) TokenLiteral() string

TokenLiteral returns the literal value of a token

type Program

type Program struct {
	Statements []Statement
}

Program is a collection of statements

func DefaultParse

func DefaultParse(in string) *Program

DefaultParse sets up a default lex/parse and returns the program

func (*Program) String

func (p *Program) String() string

String returns a string representation of value

func (*Program) TokenLiteral

func (p *Program) TokenLiteral() string

TokenLiteral returns the literal value of a token

type Statement

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

Statement is a executable tree

type String

type String struct {
	Token Token
	Value string
}

String is an array of codepoints

func (*String) String

func (i *String) String() string

String returns a string representation of value

func (*String) TokenLiteral

func (i *String) TokenLiteral() string

TokenLiteral returns the literal value of a token

type Token

type Token struct {
	Type    TokenType
	Literal string
}

Token is a type and literal pair

type TokenType

type TokenType string

TokenType is a token enumeration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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