antlrbridge

package
v0.0.0-...-7b96089 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AstToPsi

func AstToPsi(sf *SourceFile, parsed antlr.ParserRuleContext) psi.Node

Types

type CharTokenizer

type CharTokenizer struct {
}

func (CharTokenizer) Count

func (c CharTokenizer) Count(text string) (int, error)

type Language

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

func (*Language) CreateSourceFile

func (l *Language) CreateSourceFile(fileName string, fileHandle repofs.FileHandle) psi.SourceFile

func (*Language) Init

func (l *Language) Init(self psi.Language, p project.Project)

func (*Language) Parse

func (l *Language) Parse(fileName string, code string) (psi.SourceFile, error)

func (*Language) ParseCodeBlock

func (l *Language) ParseCodeBlock(blockName string, block mdutils.CodeBlock) (psi.SourceFile, error)

type Node

type Node interface {
	psi.Node

	Initialize(self Node)

	Tree() antlr.ParseTree
	Ast() antlr.ParserRuleContext
	Token() antlr.Token
}

type NodeBase

type NodeBase[T antlr.ParseTree] struct {
	psi.NodeBase
	// contains filtered or unexported fields
}

func NewNodeFor

func NewNodeFor[T antlr.ParseTree](sf *SourceFile, node T) *NodeBase[T]

func (*NodeBase[T]) Ast

func (nb *NodeBase[T]) Ast() antlr.ParserRuleContext

func (*NodeBase[T]) Comments

func (nb *NodeBase[T]) Comments() []string

func (*NodeBase[T]) Initialize

func (nb *NodeBase[T]) Initialize(self Node)

func (*NodeBase[T]) IsContainer

func (nb *NodeBase[T]) IsContainer() bool

func (*NodeBase[T]) IsLeaf

func (nb *NodeBase[T]) IsLeaf() bool

func (*NodeBase[T]) Token

func (nb *NodeBase[T]) Token() antlr.Token

func (*NodeBase[T]) Tree

func (nb *NodeBase[T]) Tree() antlr.ParseTree

func (*NodeBase[T]) Update

func (nb *NodeBase[T]) Update(context.Context) error

type SourceFile

type SourceFile struct {
	psi.NodeBase
	// contains filtered or unexported fields
}

func NewSourceFile

func NewSourceFile(l *Language, name string, handle repofs.FileHandle) *SourceFile

func (*SourceFile) Error

func (sf *SourceFile) Error() error

func (*SourceFile) GetAdjustedTokenInterval

func (sf *SourceFile) GetAdjustedTokenInterval(n Node) antlr.Interval

func (*SourceFile) Language

func (sf *SourceFile) Language() psi.Language

func (*SourceFile) Load

func (sf *SourceFile) Load() error

func (*SourceFile) MergeCompletionResults

func (sf *SourceFile) MergeCompletionResults(ctx context.Context, scope psi.Scope, cursor psi.Cursor, newSource psi.SourceFile, newAst psi.Node) error

func (*SourceFile) Name

func (sf *SourceFile) Name() string

func (*SourceFile) OriginalText

func (sf *SourceFile) OriginalText() string

func (*SourceFile) Parse

func (sf *SourceFile) Parse(filename string, sourceCode string) (result psi.Node, err error)

func (*SourceFile) Path

func (sf *SourceFile) Path() string

func (*SourceFile) Replace

func (sf *SourceFile) Replace(code string) error

func (*SourceFile) Root

func (sf *SourceFile) Root() psi.Node

func (*SourceFile) SetRoot

func (sf *SourceFile) SetRoot(node antlr.ParserRuleContext, original string, tokens *antlr.CommonTokenStream) error

func (*SourceFile) ToCode

func (sf *SourceFile) ToCode(node psi.Node) (mdutils.CodeBlock, error)

Jump to

Keyboard shortcuts

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