parser

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustParseExpr

func MustParseExpr(s string) expr.Expr

MustParseExpr calls ParseExpr and panics if it returns an error.

func ParseExpr

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

ParseExpr parses an expression.

func ParsePath

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

ParsePath parses a path to a value in an object.

func ParseQuery

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

ParseQuery parses a query string and returns its AST representation.

Types

type Options

type Options struct {
	// A table of function packages.
	Packages functions.Packages
}

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 Chai SQL Parser.

func NewParser

func NewParser(r io.Reader) *Parser

NewParser returns a new instance of Parser.

func NewParserWithOptions

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

NewParserWithOptions returns a new instance of Parser using given Options.

func (*Parser) Parse

func (p *Parser) Parse(fn func(statement.Statement) error) error

ParseQuery parses a Chai SQL string and returns a Query.

func (*Parser) ParseExpr

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

ParseExpr parses an expression.

func (*Parser) ParseObject

func (p *Parser) ParseObject() (*expr.KVPairs, error)

ParseObject parses an object

func (*Parser) ParseQuery

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

ParseQuery parses a Chai SQL string and returns a Query.

func (*Parser) ParseStatement

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

ParseStatement parses a Chai SQL string and returns a statement.

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