Implemented function scanning
All checks were successful
/ test (push) Successful in 16s

This commit is contained in:
Eduard Urbach 2025-06-19 23:31:52 +02:00
parent 9b51680af5
commit c2b8db238e
Signed by: akyoto
GPG key ID: 49226B848C78F6C8
24 changed files with 624 additions and 232 deletions

14
src/errors/Common.go Normal file
View file

@ -0,0 +1,14 @@
package errors
var (
ExpectedFunctionDefinition = &String{"Expected function definition"}
ExpectedPackageName = &String{"Expected package name"}
InvalidDefinition = &String{"Invalid definition"}
MissingBlockStart = &String{"Missing '{'"}
MissingBlockEnd = &String{"Missing '}'"}
MissingGroupStart = &String{"Missing '('"}
MissingGroupEnd = &String{"Missing ')'"}
MissingParameter = &String{"Missing parameter"}
MissingType = &String{"Missing type"}
NoInputFiles = &String{"No input files"}
)

View file

@ -0,0 +1,13 @@
package errors
import "fmt"
// InvalidCharacter is created when an invalid character appears.
type InvalidCharacter struct {
Character string
}
// Error implements the error interface.
func (err *InvalidCharacter) Error() string {
return fmt.Sprintf("Invalid character '%s'", err.Character)
}

View file

@ -0,0 +1,13 @@
package errors
import "fmt"
// InvalidTopLevel error is created when a top-level instruction is not valid.
type InvalidTopLevel struct {
Instruction string
}
// Error implements the error interface.
func (err *InvalidTopLevel) Error() string {
return fmt.Sprintf("Invalid top level instruction '%s'", err.Instruction)
}

View file

@ -0,0 +1,13 @@
package errors
import "fmt"
// IsNotDirectory error is created when a path is not a directory.
type IsNotDirectory struct {
Path string
}
// Error implements the error interface.
func (err *IsNotDirectory) Error() string {
return fmt.Sprintf("'%s' is not a directory", err.Path)
}