parser

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustParseExpr added in v0.10.0

func MustParseExpr(s string) expr.Expr

MustParseExpr calls ParseExpr and panics if it returns an error.

func ParseExpr added in v0.10.0

func ParseExpr(s string) (expr.Expr, error)

ParseExpr parses an expression.

func ParsePath added in v0.7.0

func ParsePath(s string) (document.Path, error)

ParsePath parses a path to a value in a document.

func ParseQuery

func ParseQuery(s string) (query.Query, error)

ParseQuery parses a query string and returns its AST representation.

Types

type Options added in v0.9.0

type Options struct {
	// A map of builtin SQL functions.
	Functions expr.Functions
}

Options of the SQL parser.

type ParseError

type ParseError struct {
	Message  string
	Found    string
	Expected []string
	Pos      scanner.Pos
}

ParseError represents an error that occurred during parsing.

func (*ParseError) Error

func (e *ParseError) Error() string

Error returns the string representation of the error.

type Parser

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

Parser represents an Genji SQL Parser.

func NewParser

func NewParser(r io.Reader) *Parser

NewParser returns a new instance of Parser.

func NewParserWithOptions added in v0.9.0

func NewParserWithOptions(r io.Reader, opts *Options) *Parser

NewParserWithOptions returns a new instance of Parser using given Options.

func (*Parser) ParseExpr

func (p *Parser) ParseExpr() (e expr.Expr, lit string, err error)

ParseExpr parses an expression.

func (*Parser) ParseQuery

func (p *Parser) ParseQuery() (query.Query, error)

ParseQuery parses a Genji SQL string and returns a Query.

func (*Parser) ParseStatement

func (p *Parser) ParseStatement() (query.Statement, error)

ParseStatement parses a Genji SQL string and returns a Statement AST object.

func (*Parser) Scan

func (p *Parser) Scan() (tok scanner.Token, pos scanner.Pos, lit string)

Scan returns the next token from the underlying scanner.

func (*Parser) ScanIgnoreWhitespace

func (p *Parser) ScanIgnoreWhitespace() (tok scanner.Token, pos scanner.Pos, lit string)

ScanIgnoreWhitespace scans the next non-whitespace and non-comment token.

func (*Parser) Unscan

func (p *Parser) Unscan()

Unscan pushes the previously read token back onto the buffer.

Jump to

Keyboard shortcuts

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