summaryrefslogtreecommitdiff
path: root/src/tparse
diff options
context:
space:
mode:
authorKyle Gunger <corechg@gmail.com>2020-07-08 17:02:34 -0400
committerKyle Gunger <corechg@gmail.com>2020-07-08 17:02:34 -0400
commit8db6eccbd4678305bf7fcb66effa1a57d929db34 (patch)
treef5d4059fb81291329d33767436403e2090b62525 /src/tparse
parent08fabe9627d89b9811b0fafe1c2bb11773d02bbc (diff)
Update tree structure
Diffstat (limited to 'src/tparse')
-rw-r--r--src/tparse/tree.go12
-rw-r--r--src/tparse/type.go2
2 files changed, 11 insertions, 3 deletions
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,