Improved documentation

This commit is contained in:
2025-01-28 13:43:38 +01:00
parent fb40059113
commit 9a8cffe2f4
6 changed files with 103 additions and 71 deletions

View File

@ -1,27 +1,5 @@
package errors
var (
EmptySwitch = &Base{"Empty switch"}
ExpectedFunctionName = &Base{"Expected function name"}
ExpectedFunctionParameters = &Base{"Expected function parameters"}
ExpectedFunctionDefinition = &Base{"Expected function definition"}
ExpectedIfBeforeElse = &Base{"Expected an 'if' block before 'else'"}
InvalidNumber = &Base{"Invalid number"}
InvalidExpression = &Base{"Invalid expression"}
InvalidRune = &Base{"Invalid rune"}
InvalidStatement = &Base{"Invalid statement"}
MissingBlockStart = &Base{"Missing '{'"}
MissingBlockEnd = &Base{"Missing '}'"}
MissingExpression = &Base{"Missing expression"}
MissingGroupStart = &Base{"Missing '('"}
MissingGroupEnd = &Base{"Missing ')'"}
MissingMainFunction = &Base{"Missing main function"}
MissingOperand = &Base{"Missing operand"}
MissingType = &Base{"Missing type"}
NotImplemented = &Base{"Not implemented"}
UnknownType = &Base{"Unknown type"}
)
// Base is the base class for errors that have no parameters.
type Base struct {
Message string

23
src/errors/Common.go Normal file
View File

@ -0,0 +1,23 @@
package errors
var (
EmptySwitch = &Base{"Empty switch"}
ExpectedFunctionName = &Base{"Expected function name"}
ExpectedFunctionParameters = &Base{"Expected function parameters"}
ExpectedFunctionDefinition = &Base{"Expected function definition"}
ExpectedIfBeforeElse = &Base{"Expected an 'if' block before 'else'"}
InvalidNumber = &Base{"Invalid number"}
InvalidExpression = &Base{"Invalid expression"}
InvalidRune = &Base{"Invalid rune"}
InvalidStatement = &Base{"Invalid statement"}
MissingBlockStart = &Base{"Missing '{'"}
MissingBlockEnd = &Base{"Missing '}'"}
MissingExpression = &Base{"Missing expression"}
MissingGroupStart = &Base{"Missing '('"}
MissingGroupEnd = &Base{"Missing ')'"}
MissingMainFunction = &Base{"Missing main function"}
MissingOperand = &Base{"Missing operand"}
MissingType = &Base{"Missing type"}
NotImplemented = &Base{"Not implemented"}
UnknownType = &Base{"Unknown type"}
)