errors

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 License: MIT Imports: 2 Imported by: 6

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
	// 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 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) IsUnexpectedCase added in v0.1.11

func (e *Error) IsUnexpectedCase() bool

IsUnexpectedCase checks if error is a token error for 'case' statement

func (*Error) IsUnexpectedEmptyLine added in v0.1.11

func (e *Error) IsUnexpectedEmptyLine(len int) bool

IsUnexpectedEmptyLine checks if error is an 'end' with empty line

func (*Error) IsUnexpectedEnd

func (e *Error) IsUnexpectedEnd() bool

IsUnexpectedEnd checks if error is unexpected "end" keyword error

func (*Error) IsUnexpectedToken added in v0.1.11

func (e *Error) IsUnexpectedToken() bool

IsUnexpectedToken checks if error is unexpected token error

func (*Error) IsUnexpectedWhen added in v0.1.11

func (e *Error) IsUnexpectedWhen() bool

IsUnexpectedWhen checks if error is a token error for 'case'atement

Jump to

Keyboard shortcuts

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