The section kind specific maps are gone

I've REPLACED IT with the unified sections map. Interfaces, baby!
This commit is contained in:
2022-09-04 19:30:59 -04:00
parent 9269161138
commit f3c72f8f30
5 changed files with 53 additions and 94 deletions

View File

@@ -20,7 +20,12 @@ type ParsingOperation struct {
// 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) {
parser := ParsingOperation { modulePath: modulePath }
parser := ParsingOperation {
modulePath: modulePath,
tree: &SyntaxTree {
sections: make(map[string] Section),
},
}
if parser.modulePath[len(parser.modulePath) - 1] != '/' {
parser.modulePath += "/"
@@ -54,9 +59,6 @@ func (parser *ParsingOperation) parse (sourceFile *file.File) (err error) {
if err != nil { return }
// reset the parser
if parser.tree == nil {
parser.tree = &SyntaxTree { }
}
if len(tokens) == 0 { return }
parser.tokens = tokens
parser.token = tokens[0]