editor

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Editor

type Editor struct {
	Input string

	ParseTree   antlr.ParseTree
	ParseErrors []SynErr
	// contains filtered or unexported fields
}

func NewEditor

func NewEditor(input string) *Editor

NewEditor initializes a new Editor with various autocompletion capabilities.

func (Editor) GetCompletion

func (e Editor) GetCompletion(line, column int, doFilter bool) comp.Result

func (Editor) GetCompletionInfo

func (e Editor) GetCompletionInfo(line, column int) comp.Info

func (Editor) GetElement

func (e Editor) GetElement(line, column int) antlr.Tree

GetElement returns the ParseTree at the given line and column.

func (Editor) GetElementForCompletion

func (e Editor) GetElementForCompletion(line, column int) antlr.Tree

func (Editor) GetReferences

func (e Editor) GetReferences(line, column int) []antlr.ParserRuleContext

func (*Editor) SetSchema

func (e *Editor) SetSchema(schema comp.Metadata)

SetSchema updates the metadata used for providing schema-specific completion.

func (*Editor) Update

func (e *Editor) Update(input string)

Update parses the given input, records various ParseTree elements and updates the reference providers to provide more appropriate completion results.

type ErrorListener

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

func Parse

Parse creates a ParseTree from the given input and collects RuleContext nodes for post-processing. The returned Providers hold references to specific elements encountered during the tree traversal.

func (ErrorListener) ReportAmbiguity

func (el ErrorListener) ReportAmbiguity(antlr.Parser, *antlr.DFA, int, int, bool, *antlr.BitSet, antlr.ATNConfigSet)

func (ErrorListener) ReportAttemptingFullContext

func (el ErrorListener) ReportAttemptingFullContext(antlr.Parser, *antlr.DFA, int, int, *antlr.BitSet, antlr.ATNConfigSet)

func (ErrorListener) ReportContextSensitivity

func (el ErrorListener) ReportContextSensitivity(antlr.Parser, *antlr.DFA, int, int, int, antlr.ATNConfigSet)

func (*ErrorListener) SyntaxError

func (el *ErrorListener) SyntaxError(
	r antlr.Recognizer, offendingSymbol any, line, column int, msg string, e antlr.RecognitionException)

type PosConv

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

PosConv provides line and column info for absolute positions in a multi-line string and vice versa.

func NewPosConv

func NewPosConv(input string) *PosConv

NewPosConv splits the given input line by line and indexes their position.

func (PosConv) ToAbsolute

func (pc PosConv) ToAbsolute(line, column int) int

ToAbsolute calculates the absolute position of line and column.

func (PosConv) ToRelative

func (pc PosConv) ToRelative(abs int) (int, int)

ToRelative determines line and column for a given position.

type SynErr

type SynErr struct {
	Line int
	Col  int
	Msg  string
}

Jump to

Keyboard shortcuts

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