From f6aeae1d55ca82a1b398b58b31625b8cc471584d Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Wed, 7 Sep 2022 12:20:34 -0400 Subject: [PATCH] Created basic data structures for analyzer --- analyzer/analyzer.go | 6 ++++++ analyzer/table.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 analyzer/analyzer.go create mode 100644 analyzer/table.go diff --git a/analyzer/analyzer.go b/analyzer/analyzer.go new file mode 100644 index 0000000..a960082 --- /dev/null +++ b/analyzer/analyzer.go @@ -0,0 +1,6 @@ +package analyzer + +// AnalysisOperation holds information about an ongoing analysis operation. +type AnalysisOperation struct { + sectionTable SectionTable +} diff --git a/analyzer/table.go b/analyzer/table.go new file mode 100644 index 0000000..4a6a72c --- /dev/null +++ b/analyzer/table.go @@ -0,0 +1,29 @@ +package analyzer + +// locator uniquely identifies a section in the section table. +type locator struct { + modulePath string + name string +} + +// SectionTable stores a list of semantically analized sections from one module, +// and all sections that it requires from other modules. +type SectionTable map[locator] Section + +// SectionKind differentiates Section interfaces. +type SectionKind int + +const ( + SectionKindType = iota + SectionKindObjt + SectionKindEnum + SectionKindFace + SectionKindData + SectionKindFunc +) + +// Section is a semantically analyzed section. +type Section interface { + Kind () (kind SectionKind) + Name () (name string) +}