compiler

package
v0.0.0-...-959c02d Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncorrectGraphName        = errors.New("incorrect graph name")
	ErrIncorrectLabelName        = errors.New("incorrect label name")
	ErrIncorrectIndexName        = errors.New("incorrect index name")
	ErrGraphNotChosen            = errors.New("please choose graph first")
	ErrVariableReferenceNotExits = errors.New("reference not exists variable")
)

Functions

func Compile

func Compile(sc *stmtctx.Context, node ast.StmtNode) (executor.Executor, error)

Compile compiles the statement AST node into an executable statement. The compiler relay on the statement context to retrieve some environment information and set some intermediate variables while compiling. The catalog is used to resolve names in the query.

Types

type MacroExpansion

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

MacroExpansion is used to expand the PathPatternMacros.

 PATH has_parent AS () -[:has_father|has_mother]-> (:Person)
 SELECT ancestor.name
	  FROM MATCH (p1:Person) -/:has_parent+/-> (ancestor)
		 , MATCH (p2:Person) -/:has_parent+/-> (ancestor)
	 WHERE p1.name = 'Mario'
	   AND p2.name = 'Luigi'

The MacroExpansion will replace the `has_parent` macro.

func NewMacroExpansion

func NewMacroExpansion() *MacroExpansion

func (*MacroExpansion) Enter

func (m *MacroExpansion) Enter(n ast.Node) (node ast.Node, skipChildren bool)

func (*MacroExpansion) Leave

func (m *MacroExpansion) Leave(n ast.Node) (node ast.Node, ok bool)

type Preprocess

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

Preprocess is used to validate the AST to ensure the AST is valid.

func NewPreprocess

func NewPreprocess(sc *stmtctx.Context) *Preprocess

NewPreprocess returns a preprocess visitor.

func (*Preprocess) Enter

func (p *Preprocess) Enter(n ast.Node) (node ast.Node, skipChildren bool)

Enter implements the ast.Visitor interface.

func (*Preprocess) Error

func (p *Preprocess) Error() error

Error returns the internal error of preprocess.

func (*Preprocess) Leave

func (p *Preprocess) Leave(n ast.Node) (node ast.Node, ok bool)

Leave implements the ast.Visitor interface.

type PropertyPreparation

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

PropertyPreparation is used to create property lazily. In zGraph: only Graph/Label/Index objects are required to create explicitly. All properties will be created at the first time to be used. The PropertyPreparation will visit the whole AST and find

func NewPropertyPreparation

func NewPropertyPreparation(sc *stmtctx.Context) *PropertyPreparation

func (*PropertyPreparation) CreateMissing

func (p *PropertyPreparation) CreateMissing() error

CreateMissing creates the missing properties.

func (*PropertyPreparation) Enter

func (p *PropertyPreparation) Enter(n ast.Node) (node ast.Node, skipChildren bool)

func (*PropertyPreparation) Leave

func (p *PropertyPreparation) Leave(n ast.Node) (node ast.Node, ok bool)

Jump to

Keyboard shortcuts

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