ref

package
v0.0.0-...-1adbf8b Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Present = struct{}{}

Present indicates presence in a map.

Functions

This section is empty.

Types

type Index

type Index struct {
	Names                    []string
	NamesByQuery             [][]string
	ReferencesByName         map[string][]antlr.ParserRuleContext
	ReferencesByQueryAndName []map[string][]antlr.ParserRuleContext
}

func NewIndex

func NewIndex() *Index

func (*Index) Add

func (i *Index) Add(ctx antlr.ParserRuleContext, addName bool)

func (*Index) AddQuery

func (i *Index) AddQuery()

func (*Index) AddVariable

func (i *Index) AddVariable(ctx *parser.VariableContext)

AddVariable registers a new variable context. Variables have specific rules, because they participate in autocompletion. We should not add to the names list variables that are in expression.

type Listener

type Listener struct {
	Queries            []parser.CypherQueryContext
	QueriesAndCommands []antlr.ParserRuleContext
	Statements         []parser.CypherPartContext
	Raw                []antlr.ParserRuleContext
	Indexes            map[string]*Index
	InConsoleCommand   bool
	parser.BaseCypherListener
}

Listener implements callback methods, which are invoked upon AST traversal. It collects certain nodes and indexes them for later retrieval.

func NewListener

func NewListener() *Listener

NewListener creates a Listener with an empty Index for each symbolic context.

func (*Listener) EnterCypherConsoleCommand

func (l *Listener) EnterCypherConsoleCommand(ctx *parser.CypherConsoleCommandContext)

EnterCypherConsoleCommand is called when production cypherConsoleCommand is entered.

func (*Listener) EnterCypherPart

func (l *Listener) EnterCypherPart(ctx *parser.CypherPartContext)

EnterCypherPart is called when production cypherPart is entered.

func (*Listener) EnterCypherQuery

func (l *Listener) EnterCypherQuery(ctx *parser.CypherQueryContext)

EnterCypherQuery is called when production cypherQuery is entered.

func (*Listener) EnterRaw

func (l *Listener) EnterRaw(ctx antlr.ParserRuleContext)

EnterRaw is called when production parserRule is entered.

func (*Listener) ExitCypherConsoleCommand

func (l *Listener) ExitCypherConsoleCommand(ctx *parser.CypherConsoleCommandContext)

ExitCypherConsoleCommand is called when production cypherConsoleCommand is exited.

func (*Listener) ExitCypherPart

func (l *Listener) ExitCypherPart(ctx *parser.CypherPartContext)

ExitCypherPart is called when production cypherPart is exited.

func (*Listener) ExitLabelName

func (l *Listener) ExitLabelName(ctx *parser.LabelNameContext)

ExitLabelName is called when production labelName is exited.

func (*Listener) ExitParameterName

func (l *Listener) ExitParameterName(ctx *parser.ParameterNameContext)

ExitParameterName is called when production parameterName is exited.

func (*Listener) ExitPropertyKeyName

func (l *Listener) ExitPropertyKeyName(ctx *parser.PropertyKeyNameContext)

ExitPropertyKeyName is called when production propertyKeyName is exited.

func (*Listener) ExitRaw

func (l *Listener) ExitRaw(ctx antlr.ParserRuleContext)

ExitRaw is called when production parserRule is exited.

func (*Listener) ExitRelTypeName

func (l *Listener) ExitRelTypeName(ctx *parser.RelTypeNameContext)

ExitRelTypeName is called when production relTypeName is exited.

func (*Listener) ExitVariable

func (l *Listener) ExitVariable(ctx *parser.VariableContext)

ExitVariable is called when production variable is exited.

type Provider

type Provider struct {
	Queries []parser.CypherQueryContext

	Names                    []string
	NamesByQuery             [][]string
	ReferencesByName         map[string][]antlr.ParserRuleContext
	ReferencesByQueryAndName []map[string][]antlr.ParserRuleContext
}

Provider is like a flattened representation of the ParseTree.

func NewProvider

func NewProvider(queries []parser.CypherQueryContext, index *Index) *Provider

func (Provider) GetNames

func (p Provider) GetNames(query *parser.CypherQueryContext) []string

func (Provider) GetReferences

func (p Provider) GetReferences(name string, query *parser.CypherQueryContext) []antlr.ParserRuleContext

Jump to

Keyboard shortcuts

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