parser

package
v0.0.0-...-c72f791 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: GPL-3.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ParserBase

type ParserBase struct {
	*needle.NeedleParser
	// contains filtered or unexported fields
}

ParserBase is a wrapper for the generated parser that provides some extra functionality.

func NewParserBase

func NewParserBase(data []byte, path string) (*ParserBase, error)

NewParserBase returns a new parser for the given data and path.

func NewParserFile

func NewParserFile(file string) (*ParserBase, error)

NewParserFile returns a new parser for the given file.

func (*ParserBase) Parse

func (p *ParserBase) Parse()

Parse parses the SourceMain and walks the parse tree.

func (*ParserBase) PrintlnError

func (p *ParserBase) PrintlnError()

PrintlnError prints all syntax errors to stdout.

func (*ParserBase) RegisterListener

func (p *ParserBase) RegisterListener(name string, listener antlr.ParseTreeListener)

type SyntaxError

type SyntaxError struct {
	Line    int
	Column  int
	Message string
}

SyntaxError represents a syntax error.

type SyntaxErrorListener

type SyntaxErrorListener struct {
	*antlr.DefaultErrorListener
	*needle.BaseNeedleParserListener
	Errors []SyntaxError
	Path   string
}

SyntaxErrorListener is a custom error listener that collects syntax errors.

func NewSyntaxErrorListener

func NewSyntaxErrorListener(path string) *SyntaxErrorListener

NewSyntaxErrorListener returns a new SyntaxErrorListener.

func (*SyntaxErrorListener) PrintlnError

func (s *SyntaxErrorListener) PrintlnError()

PrintlnError prints all syntax errors to stdout.

func (*SyntaxErrorListener) SyntaxError

func (s *SyntaxErrorListener) SyntaxError(_ antlr.Recognizer, _ interface{}, line, column int, msg string, _ antlr.RecognitionException)

SyntaxError is called when a syntax error is encountered.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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