From 5c2a7aeb07847040ff08f46ffdbb139af6e49d68 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Thu, 18 Aug 2022 17:39:19 -0400 Subject: [PATCH] Created base for type section parsing --- parser/body.go | 8 ++++++++ parser/tree.go | 1 + parser/type.go | 8 ++++++++ 3 files changed, 17 insertions(+) create mode 100644 parser/type.go diff --git a/parser/body.go b/parser/body.go index dfa27f7..3f181d9 100644 --- a/parser/body.go +++ b/parser/body.go @@ -21,6 +21,14 @@ func (parser *ParsingOperation) parseBody () (err error) { parser.tree.dataSections[section.name] = section if err != nil { return } case "type": + var section *TypeSection + section, err = parser.parseTypeSection() + if parser.tree.typeSections == nil { + parser.tree.typeSections = + make(map[string] *TypeSection) + } + parser.tree.typeSections[section.name] = section + if err != nil { return } case "face": case "enum": case "func": diff --git a/parser/tree.go b/parser/tree.go index 070f36a..99b93d3 100644 --- a/parser/tree.go +++ b/parser/tree.go @@ -11,6 +11,7 @@ type SyntaxTree struct { author string requires []string + typeSections map[string] *TypeSection dataSections map[string] *DataSection } diff --git a/parser/type.go b/parser/type.go new file mode 100644 index 0000000..0ba64a2 --- /dev/null +++ b/parser/type.go @@ -0,0 +1,8 @@ +package parser + +func (parser *ParsingOperation) parseTypeSection () ( + section *TypeSection, + err error, +) { + return +}