summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2021-10-30 14:35:53 -0400
committerKyle Gunger <kgunger12@gmail.com>2021-10-30 14:35:53 -0400
commit051f325d54aad24233714aabb1d616411aea1d05 (patch)
tree43b41c883fc0061978181db3196b9d9492f02bde /src
parent65eafdcefd5179eb767ce8886e19f30ea701385b (diff)
[AST] Return and type fixes
+ Allow types to include the . operator + Allow returns to have more than one value
Diffstat (limited to 'src')
-rw-r--r--src/tparse/tree-statement.go2
-rw-r--r--src/tparse/tree-value.go9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/tparse/tree-statement.go b/src/tparse/tree-statement.go
index 262bd6f..2fb6b8a 100644
--- a/src/tparse/tree-statement.go
+++ b/src/tparse/tree-statement.go
@@ -186,7 +186,7 @@ func keywordStatement(tokens *[]Token, tok, max int) (Node, int) {
// Check for a numerical value and dip
case "return":
if (*tokens)[tok].Type != DELIMIT || (*tokens)[tok].Data == "{" || (*tokens)[tok].Data == "(" {
- tmp, tok = parseValue(tokens, tok, max)
+ tmp, tok = parseValueList(tokens, tok, max)
}
case "alloc", "salloc":
// Parse value list
diff --git a/src/tparse/tree-value.go b/src/tparse/tree-value.go
index edca103..554edcd 100644
--- a/src/tparse/tree-value.go
+++ b/src/tparse/tree-value.go
@@ -362,7 +362,16 @@ func parseType(tokens *[]Token, tok, max int, param bool) (Node, int) {
case DEFWORD:
if (*tokens)[tok+1].Data == "(" {
tmp, tok = parseTypeParams(tokens, tok, max)
+ } else if (*tokens)[tok+1].Data == "." {
+ tmp.Data = t
+ out.Sub = append(out.Sub, tmp)
+ tok++
+ continue
+ } else {
+ tmp.Data = t
+ tok++
}
+ out.Sub = append(out.Sub, tmp)
return out, tok