The syntax tree is no longer passed by reference

This commit is contained in:
Sasha Koshka 2022-09-04 22:30:14 -04:00
parent 7af575e865
commit 89834ac390
3 changed files with 4 additions and 13 deletions

View File

@ -14,15 +14,15 @@ type ParsingOperation struct {
tokens []lexer.Token
tokenIndex int
tree *SyntaxTree
tree SyntaxTree
}
// Parse reads the files located in the module specified by modulePath, and
// converts them into an abstract syntax tree.
func Parse (modulePath string) (tree *SyntaxTree, err error) {
func Parse (modulePath string) (tree SyntaxTree, err error) {
parser := ParsingOperation {
modulePath: modulePath,
tree: &SyntaxTree {
tree: SyntaxTree {
sections: make(map[string] Section),
},
}

View File

@ -7,15 +7,6 @@ import "testing"
func checkTree (modulePath string, correct string, test *testing.T) {
tree, err := Parse(modulePath)
if tree == nil {
test.Log("TREE IS NIL!")
if err != io.EOF && err != nil {
test.Log("returned error:")
test.Log(err)
}
test.Fail()
return
}
treeString := tree.ToString(0)
treeRunes := []rune(treeString)

View File

@ -44,7 +44,7 @@ type Identifier struct {
trail []string
}
// TypeKind represents what kind of type a type is
// TypeKind represents what kind of type a type is.
type TypeKind int
const (