add functions and variables name

This commit is contained in:
2023-02-25 23:34:15 +00:00
parent 636101f1fa
commit 6ef6e051e6
23 changed files with 414 additions and 97 deletions

View File

@@ -1,11 +1,16 @@
package main
import (
"fmt"
"strconv"
"strings"
)
type translateString struct {
str string
code string
line int
}
var stringCompile = makeRegex("(( *)\"((\\\\([a-z\\\"'`]))|[^\\\"])*\"( *))|(( *)'((\\\\([a-z\\'\"`]))|[^\\'])*'( *))")
func isString(code UNPARSEcode) bool {
@@ -27,16 +32,16 @@ func unquoted(
}
// returns translateString, success, error
func parseString(code UNPARSEcode) (translateString, bool, string) {
func parseString(code UNPARSEcode) (translateString, bool, ArErr, int) {
trim := strings.Trim(code.code, " ")
unquoted, err := unquoted(trim)
if err != nil {
return translateString{}, false, "Syntax Error: invalid string on line " + fmt.Sprint(code.line) + ": " + code.code
return translateString{}, false, ArErr{"Syntax Error", "invalid string", code.line, code.path, code.realcode, true}, 1
}
return translateString{
str: unquoted,
line: code.line,
}, true, ""
}, true, ArErr{}, 1
}