diff --git a/parser/body.go b/parser/body.go index a7d77c1..98bf5f3 100644 --- a/parser/body.go +++ b/parser/body.go @@ -9,6 +9,13 @@ func (parser *ParsingOperation) parseBody () (err error) { switch parser.token.Value().(string) { case "data": + var section *DataSection + section, err = parser.parseDataSection() + if err != nil { return } + if parser.tree.dataSections == nil { + parser.tree.dataSections = make(map[string] *DataSection) + } + parser.tree.dataSections[section.name] = section case "type": case "face": case "enum": diff --git a/parser/data.go b/parser/data.go index 17f001d..a1348f4 100644 --- a/parser/data.go +++ b/parser/data.go @@ -1,6 +1,9 @@ package parser // parseData parses a data section -func (parser *ParsingOperation) parseData () (err error) { +func (parser *ParsingOperation) parseDataSection () ( + section *DataSection, + err error, +) { return } diff --git a/parser/tree.go b/parser/tree.go index f4c095d..19a6654 100644 --- a/parser/tree.go +++ b/parser/tree.go @@ -11,7 +11,7 @@ type SyntaxTree struct { author string requires []string - dataSections []DataSection + dataSections map[string] *DataSection } // Identifier represents a chain of arguments separated by a dot.