add panic and repo config

This commit is contained in:
2023-03-28 22:51:41 +01:00
parent c5c5fef4bc
commit be2ac857ca
3 changed files with 35 additions and 3 deletions

9
src/config.go Normal file
View File

@@ -0,0 +1,9 @@
package main
var websiteLang = "https://argon.wbell.dev/"
var docs = "https://argon.wbell.dev/docs/"
var mainrepo = "https://github.com/Open-Argon/argon-v3"
var mainissuesPage = "https://github.com/Open-Argon/argon-v3/issues"
var fork = false
var forkrepo = ""
var forkissuesPage = ""

View File

@@ -1,6 +1,7 @@
package main package main
import ( import (
"fmt"
"os" "os"
) )
@@ -17,6 +18,26 @@ func newscope() ArObject {
} }
func main() { func main() {
defer func() {
if r := recover(); r != nil {
fmt.Println("There was a fundamental error in argon v3 that caused it to crash.")
fmt.Println()
if fork {
fmt.Println("This is a fork of Open-Argon. Please report this to the fork's maintainer.")
fmt.Println("Fork repo:", forkrepo)
fmt.Println("Fork issue page:", forkissuesPage)
fmt.Println()
} else {
fmt.Println("Please report this to the Open-Argon team.")
fmt.Println("Main repo:", mainrepo)
fmt.Println("Issue page:", mainissuesPage)
fmt.Println()
}
fmt.Println("please include the following information:")
fmt.Println("panic:", r)
os.Exit(1)
}
}()
initRandom() initRandom()
garbageCollect() garbageCollect()
global := makeGlobal() global := makeGlobal()

View File

@@ -28,9 +28,11 @@ func parseTryCatch(code UNPARSEcode, index int, codelines []UNPARSEcode) (TryCat
return TryCatch{}, false, err, i return TryCatch{}, false, err, i
} }
totalIndex += i totalIndex += i
/*
if index+totalIndex >= len(codelines) { if index+totalIndex >= len(codelines) {
return TryCatch{}, false, ArErr{"Syntax Error", "expected catch statement", code.line, code.path, code.realcode, true}, i return TryCatch{}, false, ArErr{"Syntax Error", "expected catch statement", code.line, code.path, code.realcode, true}, i
} }
*/
catchtrimmed := strings.TrimSpace(codelines[index+totalIndex].code) catchtrimmed := strings.TrimSpace(codelines[index+totalIndex].code)
if !catchCompiled.MatchString(catchtrimmed) { if !catchCompiled.MatchString(catchtrimmed) {
return TryCatch{}, false, ArErr{"Syntax Error", "invalid syntax", code.line, code.path, code.realcode, true}, i return TryCatch{}, false, ArErr{"Syntax Error", "invalid syntax", code.line, code.path, code.realcode, true}, i