parser

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

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

Go to latest
Published: Mar 23, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package parser contains all the logic to parse

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(query string) (commandResult command.Command, finalErr error)

Types

type Assert

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

An Assert is a kind of error that occurs due to a bug in the parser itself.

type AssertionError

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

AssertionError is raised when an internal invariant is violated, indicating a programming bug.

func (AssertionError) Error

func (err AssertionError) Error() string

type Parser

type Parser struct {
	Buffer string

	Pretty bool
	// contains filtered or unexported fields
}

func (*Parser) AST

func (t *Parser) AST() *node32

func (*Parser) Add

func (t *Parser) Add(rule pegRule, begin, end, index uint32)

func (*Parser) Execute

func (p *Parser) Execute()

func (*Parser) Init

func (p *Parser) Init()

func (*Parser) Parse

func (p *Parser) Parse(rule ...int) error

func (*Parser) PrettyPrintSyntaxTree

func (t *Parser) PrettyPrintSyntaxTree(buffer string)

func (*Parser) Print

func (t *Parser) Print()

func (*Parser) PrintSyntaxTree

func (p *Parser) PrintSyntaxTree()

func (*Parser) Reset

func (p *Parser) Reset()

func (*Parser) Tokens

func (t *Parser) Tokens() []token32

func (*Parser) Trim

func (t *Parser) Trim(length uint32)

type ParserError

type ParserError error

A ParserError wraps an error raised during parser execution.

type SyntaxError

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

SyntaxError is raised when the user query is invalid. This can happen for two reasons: * The query does not generate a valid AST. * Invalid input is provided

func (SyntaxError) Error

func (err SyntaxError) Error() string

func (SyntaxError) Token

func (err SyntaxError) Token() string

Token returns the token of the AST related to the parsing error.

type SyntaxErrors

type SyntaxErrors []SyntaxError

SyntaxErrors is a slice of SyntaxErrors implementing Error() method.

func (SyntaxErrors) Error

func (errors SyntaxErrors) Error() string

Jump to

Keyboard shortcuts

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