From e630ec6f04b01298048a97c2697bd4ed3d448b41 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Thu, 25 Aug 2022 12:02:43 -0400 Subject: [PATCH] Added function section to tree --- parser/tree.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/parser/tree.go b/parser/tree.go index 8d247c7..d5c3bc9 100644 --- a/parser/tree.go +++ b/parser/tree.go @@ -16,6 +16,7 @@ type SyntaxTree struct { enumSections map[string] *EnumSection faceSections map[string] *FaceSection dataSections map[string] *DataSection + funcSections map[string] *FuncSection } // Identifier represents a chain of arguments separated by a dot. @@ -229,3 +230,20 @@ type FaceSection struct { permission types.Permission behaviors map[string] FaceBehavior } + +// Block represents a scoped/indented block of code. +// TODO: blocks will not directly nest. nested blocks will be stored as a part +// of certain control flow statements. +type Block []Phrase + +// FuncSection represents a function section. +type FuncSection struct { + location file.Location + name string + permission types.Permission + + receiver *Declaration + inputs []Declaration + outputs []Declaration + root *Block +}