Documentation
¶
Overview ¶
Package diagnostics provides structures for better comple-time error handling.
Index ¶
Constants ¶
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 WarningCode ¶
type WarningCode int
WarningCode is code corresponding to a specific kind of warning in source code.