mirror of
https://github.com/Open-Argon/argon-v2.git
synced 2026-10-28 09:44:03 +00:00
add set type to set variable data type
This commit is contained in:
1 parent
e8a5a2ab00
commit
8466e481dc
2 files changed
+6
No files matched your search
@@ -18,6 +18,7 @@ type whileLoop struct {
|
||||
}
|
||||
|
||||
type setVariable struct {
|
||||
TYPE string
|
||||
variable string
|
||||
value interface{}
|
||||
line int
|
||||
|
||||
@@ -111,6 +111,10 @@ var translateline = func(i int, codearray []code) (interface{}, int) {
|
||||
} else if setVariableCompile.MatchString(codeseg.code) {
|
||||
VAR := strings.Split(codeseg.code, "=")
|
||||
firstSplit := strings.Split(strings.Trim(VAR[0], " "), " ")
|
||||
TYPE := "var"
|
||||
if len(firstSplit) > 1 {
|
||||
TYPE = firstSplit[0]
|
||||
}
|
||||
variable := firstSplit[len(firstSplit)-1]
|
||||
resp, worked := translateprocess(code{code: VAR[1],
|
||||
line: codeseg.line})
|
||||
@@ -118,6 +122,7 @@ var translateline = func(i int, codearray []code) (interface{}, int) {
|
||||
log.Fatal("invalid value")
|
||||
}
|
||||
return setVariable{
|
||||
TYPE: TYPE,
|
||||
variable: variable,
|
||||
value: resp,
|
||||
line: codeseg.line,
|
||||
|
||||
Reference in new issue
Block a user