parser

package
v0.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 18 Imported by: 1

Documentation

Overview

This file defines the functions used to parse Aliases

This file contains functions to parse function/struct/... declarations

This file defines the functions used to parse expressions (except parser.alias() which can be found in alias.go)

The rules are roughly sorted by precedence in ascending order, meaning functions further down in the file have higher precedence than those higher up.

This File defines the entry point and some general functions of the parser

This file defines functions to parse DDP statements.

This file contains functions to match and consume tokens

This file contains functions to parse DDP Types

This file contains general utility functions used in the parser

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
	// Annotators that are used to annotate the AST with additional information
	// They are called after the parsing is done
	Annotators []ast.Annotator
}

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
The resolver package should not be used independently from the parser.
The resolver package should not be used independently from the parser.

Jump to

Keyboard shortcuts

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