From fb43f96acc5c97ead8910c754a17cb64860f35dd Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Wed, 24 Aug 2022 18:22:47 -0400 Subject: [PATCH] Added bit fields to tree and ToString for object member --- parser/tree-tostring.go | 4 ++++ parser/tree.go | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/parser/tree-tostring.go b/parser/tree-tostring.go index adbfcbd..6694167 100644 --- a/parser/tree-tostring.go +++ b/parser/tree-tostring.go @@ -297,6 +297,10 @@ func (member ObjtMember) ToString (indent int) (output string) { output += member.permission.ToString() + " " output += member.name + ":" output += member.what.ToString() + + if member.bitWidth > 0 { + output += fmt.Sprint(":", member.bitWidth) + } isComplexInitialization := member.defaultValue.kind == ArgumentKindObjectInitializationValues || diff --git a/parser/tree.go b/parser/tree.go index a0394ed..c450bd7 100644 --- a/parser/tree.go +++ b/parser/tree.go @@ -178,8 +178,9 @@ type TypeSection struct { type ObjtMember struct { location file.Location name string - + what Type + bitWidth int permission types.Permission defaultValue Argument } @@ -188,7 +189,8 @@ type ObjtMember struct { type ObjtSection struct { location file.Location name string - + + // TODO: make this Identifier instead of Type inherits Type permission types.Permission // TODO: order matters here we need to store these in an array @@ -225,6 +227,7 @@ type FaceBehavior struct { type FaceSection struct { location file.Location name string + // TODO: make this Identifier instead of string inherits string permission types.Permission