This commit is contained in:
2023-03-13 19:27:16 +00:00
parent 7220d12fb6
commit 0a85087bb9
15 changed files with 335 additions and 132 deletions

View File

@@ -1,10 +1,12 @@
package main
import (
"fmt"
"strings"
"sync"
)
var SpacelessVariableCompiled = makeRegex(`([a-zA-Z_]|(\p{L}\p{M}*))([a-zA-Z0-9_]|(\p{L}\p{M}*))*`)
var variableCompile = makeRegex(`( *)([a-zA-Z_]|(\p{L}\p{M}*))([a-zA-Z0-9_]|(\p{L}\p{M}*))*( *)`)
var validname = makeRegex(`(.|\n)*(\(( *)((([a-zA-Z_]|(\p{L}\p{M}*))([a-zA-Z0-9_]|(\p{L}\p{M}*))*)(( *)\,( *)([a-zA-Z_]|(\p{L}\p{M}*))([a-zA-Z0-9_]|(\p{L}\p{M}*))*)*)?( *)\))`)
var setVariableCompile = makeRegex(`( *)(let( +))(.|\n)+( *)=(.|\n)+`)
@@ -162,6 +164,7 @@ func parseSetVariable(code UNPARSEcode, index int, lines []UNPARSEcode, isLine i
}
func parseAutoAsignVariable(code UNPARSEcode, index int, lines []UNPARSEcode, isLine int) (setVariable, bool, ArErr, int) {
fmt.Println("autoasign", code.code)
trim := strings.TrimSpace(code.code)
equalsplit := strings.SplitN(trim, "=", 2)
name := strings.TrimSpace(equalsplit[0])
@@ -190,6 +193,7 @@ func parseAutoAsignVariable(code UNPARSEcode, index int, lines []UNPARSEcode, is
if !success {
return setVariable{}, false, err, i
}
fmt.Println("autoasign", code.code, "success")
return setVariable{TYPE: "auto", toset: toset, value: value, function: function, params: params, line: code.line, code: code.code, path: code.path}, true, ArErr{}, i + namei - 1
}