diagnostics

package
v0.0.0-...-3e171d2 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package diagnostics provides structures for better comple-time error handling.

Index

Constants

View Source
const (
	NotClosedStringErrorCode = iota
	NotClosedMultiLineStringErrorCode
	NotClosedCommentErrorCode
	DigitNotCorrespondsToBaseErrorCode
	UnexpectedLetterWhenParsingNumberErrorCode
	EmptyNumberFoundErrorCode
	UnexpectedCharacterFoundWhileScanningErrorCode
	UnexpectedTokenErrorCode
	NoParsingFunctionFoundErrorCode
)

List of all possible errors.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeError

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

CodeError represents problems in code which are fatal for a compiler.

func NewCodeError

func NewCodeError(location *utils.CodePartLocation, code ErrorCode,
	ctx []interface{}) *CodeError

NewCodeError allocates and initializes CodeError struct.

type CodeProblem

type CodeProblem interface {
	// contains filtered or unexported methods
}

CodeProblem represents a warning or error in source code.

type CodeWarning

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

CodeWarnings represents problems in code which are not that fatal for a compiler.

type Diagnostics

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

Diagnostics stores list of problems in source code to then print them when required.

func NewDiagnostics

func NewDiagnostics() *Diagnostics

NewDiagnostics initializes Diagnostics struct will empty list of problems.

func (*Diagnostics) AddError

func (d *Diagnostics) AddError(error *CodeError)

AddError adds code error to the list of problems in source code.

func (*Diagnostics) AddWarning

func (d *Diagnostics) AddWarning(warning *CodeWarning)

AddWarning adds code warning to the list of problems in source code.

func (*Diagnostics) PrintProblems

func (d *Diagnostics) PrintProblems()

PrintProblems prints out all code problems in source code.

type ErrorCode

type ErrorCode int

ErrorCode is code corresponding to a specific kind of error.

type WarningCode

type WarningCode int

WarningCode is code corresponding to a specific kind of warning in source code.

Jump to

Keyboard shortcuts

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