From 8db6eccbd4678305bf7fcb66effa1a57d929db34 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Wed, 8 Jul 2020 17:02:34 -0400 Subject: Update tree structure --- src/tparse/tree.go | 12 +++++++++--- src/tparse/type.go | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/tparse') diff --git a/src/tparse/tree.go b/src/tparse/tree.go index 41896fc..48c198c 100644 --- a/src/tparse/tree.go +++ b/src/tparse/tree.go @@ -10,9 +10,15 @@ type Node struct { // Directive represents a block or single directive type Directive struct { Type string - ID string + Data string - Data []string + Param Paramaters +} + +// Paramaters represents a set of paramaters for a directive +type Paramaters struct { + In []string + Out []string } func handleCode(tokens *[]Token, start int) (Node, int) { @@ -30,7 +36,7 @@ func handlePre(tokens *[]Token, start int) (Node, int) { // CreateTree takes a series of tokens and converts them into an AST func CreateTree(tokens *[]Token, start int) Node { out := Node{} - out.Dir = Directive{Type: "root", ID: "root"} + out.Dir = Directive{Type: "root"} var tmp Node diff --git a/src/tparse/type.go b/src/tparse/type.go index dc0df10..735f681 100644 --- a/src/tparse/type.go +++ b/src/tparse/type.go @@ -40,6 +40,8 @@ var RESWORD = map[string]int{ "int": KEYTYPE, "float": KEYTYPE, + "string": KEYTYPE, + "struct": KEYWORD, "type": KEYWORD, -- cgit v1.2.3