errors

package
v0.0.0-...-8c2d49f Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// EndOfFileError represents normal EOF error
	EndOfFileError
	// UnexpectedTokenError means that token is not what we expected
	UnexpectedTokenError
	// UnexpectedEndError means we get unexpected "end" keyword (this is mainly created for REPL)
	UnexpectedEndError
	// UnexpectedEOFError means we got EOF when we expected another token
	UnexpectedEOFError
	// MethodDefinitionError means there's an error on method definition's method name
	MethodDefinitionError
	// InvalidAssignmentError means user assigns value to wrong type of expressions
	InvalidAssignmentError
	// SyntaxError means there's a grammatical error in the source code
	SyntaxError
	// ArgumentError means there's a method parameter's definition error
	ArgumentError
)

Enums for different kinds of syntax errors

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	// Message contains the readable message of error
	Message string
	ErrType int
}

Error represents parser's parsing error

func InitError

func InitError(msg string, errType int) *Error

InitError is a helper function for easily initializing error object

func NewArgumentError

func NewArgumentError(formerArgType, laterArgType int, argLiteral string, line int) *Error

NewArgumentError is a helper function the helps initializing argument errors

func NewTypeParsingError

func NewTypeParsingError(tokenLiteral, targetType string, line int) *Error

NewTypeParsingError is a helper function the helps initializing type parsing errors

func (*Error) IsEOF

func (e *Error) IsEOF() bool

IsEOF checks if error is end of file error

func (*Error) IsUnexpectedEOF

func (e *Error) IsUnexpectedEOF() bool

IsUnexpectedEOF check if error is unexpected EOF token

func (*Error) IsUnexpectedEnd

func (e *Error) IsUnexpectedEnd() bool

IsUnexpectedEnd checks if error is unexpected "}" error

func (*Error) IsUnexpectedSwitch

func (e *Error) IsUnexpectedSwitch() bool

IsUnexpectedSwitch checks if error is a token error for 'switch' statement

func (*Error) IsUnexpectedToken

func (e *Error) IsUnexpectedToken() bool

IsUnexpectedToken checks if error is unexpected token error

Jump to

Keyboard shortcuts

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