summaryrefslogtreecommitdiff
path: root/src/tparse
diff options
context:
space:
mode:
Diffstat (limited to 'src/tparse')
-rw-r--r--src/tparse/resolver.go3
-rw-r--r--src/tparse/token.go6
-rw-r--r--src/tparse/tree.go3
3 files changed, 5 insertions, 7 deletions
diff --git a/src/tparse/resolver.go b/src/tparse/resolver.go
index 8408a1c..5267887 100644
--- a/src/tparse/resolver.go
+++ b/src/tparse/resolver.go
@@ -19,5 +19,6 @@ package tparse
//TODO: Everything
/*
- This file is suppost to contain code to include other files when asked, and represents the most important part of the pre-processor
+ This file is support code to include other files when asked, and represents the most important part of the pre-processor
+ Maybe we will do this when writing the native compiler though
*/
diff --git a/src/tparse/token.go b/src/tparse/token.go
index 51a2123..182b2e0 100644
--- a/src/tparse/token.go
+++ b/src/tparse/token.go
@@ -26,12 +26,10 @@ type Token struct {
// Node represents a node in an AST
type Node struct {
- Parent *Node
- Data Token
- Sub []Node
+ Data Token
+ Sub []Node
}
func makeParent(parent *Node, child Node) {
- child.Parent = parent
parent.Sub = append(parent.Sub, child)
}
diff --git a/src/tparse/tree.go b/src/tparse/tree.go
index 02c8171..ed19e6d 100644
--- a/src/tparse/tree.go
+++ b/src/tparse/tree.go
@@ -194,7 +194,7 @@ func parseType(tokens *[]Token, tok, max int, param bool) (Node, int) {
errOut("Error: unexpected token when parsing type", t)
}
- working.Sub = append(working.Sub, Node{Parent: working})
+ makeParent(working, Node{})
working = &(working.Sub[0])
}
@@ -220,7 +220,6 @@ func parseValue(tokens *[]Token, tok, max int) (Node, int) {
func MakeTree(tokens *[]Token, file string) Node {
out := Node{}
out.Data = Token{9, file, 0, 0}
- out.Parent = &out
tmp := Node{}
working := &tmp