parser

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(options Options) (*ast.Module, error)

parse the provided ddp-source-code from the given Options if an error occured the resulting Ast is nil

Types

type Options

type Options struct {
	// Optional Filename to name the source
	// this file is read if Source and Tokens are nil
	FileName string
	// Optional ddp-source-code
	// if nil, FileName is read
	Source []byte
	// Optional scanned token slice
	// if nil, Source is used
	Tokens []token.Token
	// maps modules that have already been passed by their filenames
	// the the parser may add new imported modules to this map
	// so that after passing it contains *at least* all modules
	// that the resulting module depends on
	Modules map[string]*ast.Module
	// ErrorHandler used during scanning and parsing
	// May be nil
	ErrorHandler ddperror.Handler
}

Options on where to get the source-tokens from

func (*Options) ToScannerOptions

func (options *Options) ToScannerOptions(scannerMode scanner.Mode) scanner.Options

type ParserError

type ParserError struct {
	Err        error  // the error being wrapped (maybe nil)
	Msg        string // an additional message describing the error
	ModulePath string // the module that was parsed when this error occured
	StackTrace []byte // a stack trace
}

func (*ParserError) Error

func (err *ParserError) Error() string

func (*ParserError) Unwrap

func (err *ParserError) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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