From 051f325d54aad24233714aabb1d616411aea1d05 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sat, 30 Oct 2021 14:35:53 -0400 Subject: [AST] Return and type fixes + Allow types to include the . operator + Allow returns to have more than one value --- src/tparse/tree-statement.go | 2 +- src/tparse/tree-value.go | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') 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 -- cgit v1.2.3