From ef9d518032f2fec92ed618e25c92ff2ebd11e416 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Mon, 5 Sep 2022 11:49:19 -0400 Subject: [PATCH] Renamed returnsTo to returnees --- parser/accessors.go | 12 ++++++------ parser/misc.go | 23 ----------------------- parser/phrase.go | 6 +++--- parser/tree-tostring.go | 4 ++-- parser/tree.go | 4 +--- 5 files changed, 12 insertions(+), 37 deletions(-) diff --git a/parser/accessors.go b/parser/accessors.go index fbf9a32..42b378b 100644 --- a/parser/accessors.go +++ b/parser/accessors.go @@ -215,15 +215,15 @@ func (phrase Phrase) Argument (index int) (argument Argument) { return } -// ReturnsToLength returns the amount of things the phrase returns to. -func (phrase Phrase) ReturnsToLength () (length int) { - length = len(phrase.returnsTo) +// ReturneesLength returns the amount of things the phrase returns to. +func (phrase Phrase) ReturneesLength () (length int) { + length = len(phrase.returnees) return } -// ReturnTo returns the thing alskdjaslkdjsa whatever i dont even know wtf. -func (phrase Phrase) ReturnTo (index int) (returnTo Argument) { - returnTo = phrase.returnsTo[index] +// Returnee returns the returnee at index. +func (phrase Phrase) Returnee (index int) (returnee Argument) { + returnee = phrase.returnees[index] return } diff --git a/parser/misc.go b/parser/misc.go index b2a54d5..52b3879 100644 --- a/parser/misc.go +++ b/parser/misc.go @@ -3,29 +3,6 @@ package parser import "git.tebibyte.media/arf/arf/lexer" import "git.tebibyte.media/arf/arf/infoerr" -// TODO: need to come up with another syntax for bitfields, and use that syntax -// for fixed-length arrays. the problem is, we cant use {} for those kinds of -// arrays because they aren't pointers under the hood and that goes against the -// arf design goals in a nasty ugly way, and not only that. but the :mut type -// qualifier is meaningless on fixed length arrays now. the bit field syntax -// solves both of these problems very gracefully. but now, the problem is coming -// up with new bit field syntax. implementing this change is extremely -// necessary, for it will supercharge the coherency of the language and make it -// way more awesome. -// -// this new syntax cannot conflict with arguments, so it cannot have any -// tokens that begin those. basically all symbol tokens are on the table here. -// some ideas: -// -// ro member:Type ~ 4 -// ro member:Type & 4 <- i like this one because binary &. so intuitive. -// ro member:Type % 4 -// ro member:Type | 4 -// ro member:Type ! 4 -// ro member:Type (4) <- this looks phenomenal, but it needs new tokens not -// used anywhere else, and it would be mildly annoying -// to parse. - // parseType parses a type notation of the form Name, {Name}, etc. func (parser *ParsingOperation) parseType () (what Type, err error) { err = parser.expect(lexer.TokenKindName, lexer.TokenKindLBrace) diff --git a/parser/phrase.go b/parser/phrase.go index c25458b..8864772 100644 --- a/parser/phrase.go +++ b/parser/phrase.go @@ -202,11 +202,11 @@ func (parser *ParsingOperation) parseBlockLevelPhrase ( // ...until we hit a newline if parser.token.Is(lexer.TokenKindNewline) { break } - var returnTo Argument - returnTo, err = parser.parseArgument() + var returnee Argument + returnee, err = parser.parseArgument() if err != nil { return } - phrase.returnsTo = append(phrase.returnsTo, returnTo) + phrase.returnees = append(phrase.returnees, returnee) } } diff --git a/parser/tree-tostring.go b/parser/tree-tostring.go index a7e8cb5..220cd7b 100644 --- a/parser/tree-tostring.go +++ b/parser/tree-tostring.go @@ -421,9 +421,9 @@ func (phrase Phrase) ToString (indent int, ownLine bool) (output string) { } output += "]" - if len(phrase.returnsTo) > 0 { + if len(phrase.returnees) > 0 { output += " ->" - for _, returnItem := range phrase.returnsTo { + for _, returnItem := range phrase.returnees { output += " " + returnItem.ToString(0, false) } } diff --git a/parser/tree.go b/parser/tree.go index 8f13b2c..3b5f77c 100644 --- a/parser/tree.go +++ b/parser/tree.go @@ -262,9 +262,7 @@ type Phrase struct { location file.Location command Argument arguments []Argument - // TODO: this is wack. it should be named after a plural noun like, - // returnees or something. accessor methods should beupdated to match. - returnsTo []Argument + returnees []Argument kind PhraseKind