parser

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package parser implements source code parsing. It uses parser (and lexer) generated by ANTLR4 from neva.g4 grammar file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomErrorListener added in v0.4.0

type CustomErrorListener struct {
	*antlr.DefaultErrorListener
	Errors []error
}

func (*CustomErrorListener) SyntaxError added in v0.4.0

func (c *CustomErrorListener) SyntaxError(
	recognizer antlr.Recognizer,
	offendingSymbol any,
	line, column int,
	msg string,
	e antlr.RecognitionException,
)

type Manifest

type Manifest struct {
	LanguageVersion string      `yaml:"neva"`
	Deps            []ModuleRef `yaml:"deps"`
}

type ModuleRef

type ModuleRef struct {
	Path    string `yaml:"path"`
	Version string `yaml:"version"`
	Alias   string `yaml:"alias"`
}

type Parser

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

func New

func New(isDebug bool) Parser

func (Parser) ParseFile

func (p Parser) ParseFile(bb []byte) (f src.File, err *compiler.Error)

func (Parser) ParseFiles

func (p Parser) ParseFiles(files map[string][]byte) (map[string]src.File, *compiler.Error)

func (Parser) ParseManifest

func (p Parser) ParseManifest(raw []byte) (src.ModuleManifest, error)

func (Parser) ParseModules

func (p Parser) ParseModules(
	rawMods map[src.ModuleRef]compiler.RawModule,
) (map[src.ModuleRef]src.Module, *compiler.Error)

func (Parser) ParsePackages

func (p Parser) ParsePackages(
	rawPkgs map[string]compiler.RawPackage,
	modRef src.ModuleRef,
) (map[string]src.Package, *compiler.Error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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