Renamed returnsTo to returnees

This commit is contained in:
Sasha Koshka 2022-09-05 11:49:19 -04:00
parent d8c0ce8d28
commit ef9d518032
5 changed files with 12 additions and 37 deletions

View File

@ -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
}

View File

@ -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)

View File

@ -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)
}
}

View File

@ -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)
}
}

View File

@ -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