Did some ToString stuff
This commit is contained in:
		
							parent
							
								
									3e9ff7dcd6
								
							
						
					
					
						commit
						dbd0eb570d
					
				@ -28,6 +28,7 @@ data ro jObject:thing.Thing.thing.thing
 | 
				
			|||||||
	-- that 2139
 | 
						-- that 2139
 | 
				
			||||||
	-- this 324
 | 
						-- this 324
 | 
				
			||||||
data ro kNestedObject:Obj
 | 
					data ro kNestedObject:Obj
 | 
				
			||||||
 | 
						ro newMember:Int 9023
 | 
				
			||||||
	-- that
 | 
						-- that
 | 
				
			||||||
		-- bird2 123.8439
 | 
							-- bird2 123.8439
 | 
				
			||||||
		-- bird3 9328.21348239
 | 
							-- bird3 9328.21348239
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,15 @@ package parser
 | 
				
			|||||||
import "git.tebibyte.media/arf/arf/lexer"
 | 
					import "git.tebibyte.media/arf/arf/lexer"
 | 
				
			||||||
import "git.tebibyte.media/arf/arf/infoerr"
 | 
					import "git.tebibyte.media/arf/arf/infoerr"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// TODO:
 | 
				
			||||||
 | 
					// (parser *ParsingOperation) parseDefaultValues
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// (parser *ParsingOperation) parseDefaultMemberValues (return tree of new members and a tree of member values)
 | 
				
			||||||
 | 
					// (parser *ParsingOperation) parseDefaultArrayValues
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// (parser *ParsingOperation) parseDefaultMemberValue
 | 
				
			||||||
 | 
					// (parser *ParsingOperation) parseMemberDeclaration
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// parseInitializationValues starts on the line after a data section, or a set
 | 
					// parseInitializationValues starts on the line after a data section, or a set
 | 
				
			||||||
// phrase. It checks for an indent greater than the indent of the aforementioned
 | 
					// phrase. It checks for an indent greater than the indent of the aforementioned
 | 
				
			||||||
// data section or set phrase (passed through baseIndent), and if there is,
 | 
					// data section or set phrase (passed through baseIndent), and if there is,
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										248
									
								
								parser/objt.go
									
									
									
									
									
								
							
							
						
						
									
										248
									
								
								parser/objt.go
									
									
									
									
									
								
							@ -1,125 +1,125 @@
 | 
				
			|||||||
package parser
 | 
					package parser
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
import "git.tebibyte.media/arf/arf/types"
 | 
					// import "git.tebibyte.media/arf/arf/types"
 | 
				
			||||||
import "git.tebibyte.media/arf/arf/lexer"
 | 
					// import "git.tebibyte.media/arf/arf/lexer"
 | 
				
			||||||
import "git.tebibyte.media/arf/arf/infoerr"
 | 
					// import "git.tebibyte.media/arf/arf/infoerr"
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
// parseObjtSection parses an object type definition. This allows for structured
 | 
					// // parseObjtSection parses an object type definition. This allows for structured
 | 
				
			||||||
// types to be defined, and for member variables to be added and overridden.
 | 
					// // types to be defined, and for member variables to be added and overridden.
 | 
				
			||||||
func (parser *ParsingOperation) parseObjtSection () (
 | 
					// func (parser *ParsingOperation) parseObjtSection () (
 | 
				
			||||||
	section ObjtSection,
 | 
						// section ObjtSection,
 | 
				
			||||||
	err     error,
 | 
						// err     error,
 | 
				
			||||||
) {
 | 
					// ) {
 | 
				
			||||||
	err = parser.expect(lexer.TokenKindName)
 | 
						// err = parser.expect(lexer.TokenKindName)
 | 
				
			||||||
	if err != nil { return }
 | 
						// if err != nil { return }
 | 
				
			||||||
	
 | 
						// 
 | 
				
			||||||
	section.location = parser.token.Location()
 | 
						// section.location = parser.token.Location()
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
	// get permission
 | 
						// // get permission
 | 
				
			||||||
	err = parser.nextToken(lexer.TokenKindPermission)
 | 
						// err = parser.nextToken(lexer.TokenKindPermission)
 | 
				
			||||||
	if err != nil { return }
 | 
						// if err != nil { return }
 | 
				
			||||||
	section.permission = parser.token.Value().(types.Permission)
 | 
						// section.permission = parser.token.Value().(types.Permission)
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
	// get name
 | 
						// // get name
 | 
				
			||||||
	err = parser.nextToken(lexer.TokenKindName)
 | 
						// err = parser.nextToken(lexer.TokenKindName)
 | 
				
			||||||
	if err != nil { return }
 | 
						// if err != nil { return }
 | 
				
			||||||
	section.name = parser.token.Value().(string)
 | 
						// section.name = parser.token.Value().(string)
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
	// parse inherited type
 | 
						// // parse inherited type
 | 
				
			||||||
	err = parser.nextToken(lexer.TokenKindColon)
 | 
						// err = parser.nextToken(lexer.TokenKindColon)
 | 
				
			||||||
	if err != nil { return }
 | 
						// if err != nil { return }
 | 
				
			||||||
	err = parser.nextToken()
 | 
						// err = parser.nextToken()
 | 
				
			||||||
	if err != nil { return }
 | 
						// if err != nil { return }
 | 
				
			||||||
	section.inherits, err = parser.parseIdentifier()
 | 
						// section.inherits, err = parser.parseIdentifier()
 | 
				
			||||||
	if err != nil { return }
 | 
						// if err != nil { return }
 | 
				
			||||||
	err = parser.expect(lexer.TokenKindNewline)
 | 
						// err = parser.expect(lexer.TokenKindNewline)
 | 
				
			||||||
	if err != nil { return }
 | 
						// if err != nil { return }
 | 
				
			||||||
	err = parser.nextToken()
 | 
						// err = parser.nextToken()
 | 
				
			||||||
	if err != nil { return }
 | 
						// if err != nil { return }
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
	// parse members
 | 
						// // parse members
 | 
				
			||||||
	err = parser.parseObjtMembers(§ion)
 | 
						// err = parser.parseObjtMembers(§ion)
 | 
				
			||||||
	if err != nil { return }
 | 
						// if err != nil { return }
 | 
				
			||||||
	
 | 
						// 
 | 
				
			||||||
	if len(section.members) == 0 {
 | 
						// if len(section.members) == 0 {
 | 
				
			||||||
		infoerr.NewError (
 | 
							// infoerr.NewError (
 | 
				
			||||||
			section.location,
 | 
								// section.location,
 | 
				
			||||||
			"defining an object with no members",
 | 
								// "defining an object with no members",
 | 
				
			||||||
			infoerr.ErrorKindWarn).Print()
 | 
								// infoerr.ErrorKindWarn).Print()
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
	return
 | 
						// return
 | 
				
			||||||
}
 | 
					// }
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
// parseObjtMembers parses a list of members for an object section. Indentation
 | 
					// // parseObjtMembers parses a list of members for an object section. Indentation
 | 
				
			||||||
// level is assumed.
 | 
					// // level is assumed.
 | 
				
			||||||
func (parser *ParsingOperation) parseObjtMembers (
 | 
					// func (parser *ParsingOperation) parseObjtMembers (
 | 
				
			||||||
	into *ObjtSection,
 | 
						// into *ObjtSection,
 | 
				
			||||||
) (
 | 
					// ) (
 | 
				
			||||||
	err     error,
 | 
						// err     error,
 | 
				
			||||||
) {
 | 
					// ) {
 | 
				
			||||||
	for {
 | 
						// for {
 | 
				
			||||||
		// if we've left the block, stop parsing
 | 
							// // if we've left the block, stop parsing
 | 
				
			||||||
		if !parser.token.Is(lexer.TokenKindIndent) { return }
 | 
							// if !parser.token.Is(lexer.TokenKindIndent) { return }
 | 
				
			||||||
		if parser.token.Value().(int) != 1         { return }
 | 
							// if parser.token.Value().(int) != 1         { return }
 | 
				
			||||||
		
 | 
							// 
 | 
				
			||||||
		// add member to object section
 | 
							// // add member to object section
 | 
				
			||||||
		var member ObjtMember
 | 
							// var member ObjtMember
 | 
				
			||||||
		member, err = parser.parseObjtMember()
 | 
							// member, err = parser.parseObjtMember()
 | 
				
			||||||
		into.members = append(into.members, member)
 | 
							// into.members = append(into.members, member)
 | 
				
			||||||
		if err != nil { return }
 | 
							// if err != nil { return }
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
}
 | 
					// }
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
// parseObjtMember parses a single member of an object section. Indentation
 | 
					// // parseObjtMember parses a single member of an object section. Indentation
 | 
				
			||||||
// level is assumed.
 | 
					// // level is assumed.
 | 
				
			||||||
func (parser *ParsingOperation) parseObjtMember () (
 | 
					// func (parser *ParsingOperation) parseObjtMember () (
 | 
				
			||||||
	member ObjtMember,
 | 
						// member ObjtMember,
 | 
				
			||||||
	err    error,
 | 
						// err    error,
 | 
				
			||||||
) {
 | 
					// ) {
 | 
				
			||||||
	// get permission
 | 
						// // get permission
 | 
				
			||||||
	err = parser.nextToken(lexer.TokenKindPermission)
 | 
						// err = parser.nextToken(lexer.TokenKindPermission)
 | 
				
			||||||
	if err != nil { return }
 | 
						// if err != nil { return }
 | 
				
			||||||
	member.permission = parser.token.Value().(types.Permission)
 | 
						// member.permission = parser.token.Value().(types.Permission)
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
	// get name
 | 
						// // get name
 | 
				
			||||||
	err = parser.nextToken(lexer.TokenKindName)
 | 
						// err = parser.nextToken(lexer.TokenKindName)
 | 
				
			||||||
	if err != nil { return }
 | 
						// if err != nil { return }
 | 
				
			||||||
	member.name = parser.token.Value().(string)
 | 
						// member.name = parser.token.Value().(string)
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
	// get type
 | 
						// // get type
 | 
				
			||||||
	err = parser.nextToken(lexer.TokenKindColon)
 | 
						// err = parser.nextToken(lexer.TokenKindColon)
 | 
				
			||||||
	if err != nil { return }
 | 
						// if err != nil { return }
 | 
				
			||||||
	err = parser.nextToken()
 | 
						// err = parser.nextToken()
 | 
				
			||||||
	if err != nil { return }
 | 
						// if err != nil { return }
 | 
				
			||||||
	member.what, err = parser.parseType()
 | 
						// member.what, err = parser.parseType()
 | 
				
			||||||
	if err != nil { return }
 | 
						// if err != nil { return }
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
	// if there is a bit width, get it
 | 
						// // if there is a bit width, get it
 | 
				
			||||||
	if parser.token.Is(lexer.TokenKindBinaryAnd) {
 | 
						// if parser.token.Is(lexer.TokenKindBinaryAnd) {
 | 
				
			||||||
		err = parser.nextToken(lexer.TokenKindUInt)
 | 
							// err = parser.nextToken(lexer.TokenKindUInt)
 | 
				
			||||||
		if err != nil { return }
 | 
							// if err != nil { return }
 | 
				
			||||||
		member.bitWidth = parser.token.Value().(uint64)
 | 
							// member.bitWidth = parser.token.Value().(uint64)
 | 
				
			||||||
		err = parser.nextToken()
 | 
							// err = parser.nextToken()
 | 
				
			||||||
		if err != nil { return }
 | 
							// if err != nil { return }
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
	
 | 
						// 
 | 
				
			||||||
	// parse default value
 | 
						// // parse default value
 | 
				
			||||||
	if parser.token.Is(lexer.TokenKindNewline) {
 | 
						// if parser.token.Is(lexer.TokenKindNewline) {
 | 
				
			||||||
		err = parser.nextToken()
 | 
							// err = parser.nextToken()
 | 
				
			||||||
		if err != nil { return }
 | 
							// if err != nil { return }
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
		member.value,
 | 
							// member.value,
 | 
				
			||||||
		err = parser.parseInitializationValues(1)
 | 
							// err = parser.parseInitializationValues(1)
 | 
				
			||||||
		if err != nil { return }
 | 
							// if err != nil { return }
 | 
				
			||||||
	} else {
 | 
						// } else {
 | 
				
			||||||
		member.value, err = parser.parseArgument()
 | 
							// member.value, err = parser.parseArgument()
 | 
				
			||||||
		if err != nil { return }
 | 
							// if err != nil { return }
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
		err = parser.expect(lexer.TokenKindNewline)
 | 
							// err = parser.expect(lexer.TokenKindNewline)
 | 
				
			||||||
		if err != nil { return }
 | 
							// if err != nil { return }
 | 
				
			||||||
		err = parser.nextToken()
 | 
							// err = parser.nextToken()
 | 
				
			||||||
		if err != nil { return }
 | 
							// if err != nil { return }
 | 
				
			||||||
	}
 | 
						// }
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
	return 
 | 
						// return
 | 
				
			||||||
}
 | 
					// }
 | 
				
			||||||
 | 
				
			|||||||
@ -257,7 +257,7 @@ func (argument Argument) ToString (indent int, breakLine bool) (output string) {
 | 
				
			|||||||
func (section DataSection) ToString (indent int) (output string) {
 | 
					func (section DataSection) ToString (indent int) (output string) {
 | 
				
			||||||
	output += doIndent (
 | 
						output += doIndent (
 | 
				
			||||||
		indent,
 | 
							indent,
 | 
				
			||||||
		"data ",
 | 
							"type ",
 | 
				
			||||||
		section.permission.ToString(), " ",
 | 
							section.permission.ToString(), " ",
 | 
				
			||||||
		section.name, ":",
 | 
							section.name, ":",
 | 
				
			||||||
		section.what.ToString())
 | 
							section.what.ToString())
 | 
				
			||||||
@ -265,22 +265,43 @@ func (section DataSection) ToString (indent int) (output string) {
 | 
				
			|||||||
	isComplexInitialization :=
 | 
						isComplexInitialization :=
 | 
				
			||||||
		section.value.kind == ArgumentKindObjectInitializationValues ||
 | 
							section.value.kind == ArgumentKindObjectInitializationValues ||
 | 
				
			||||||
		section.value.kind == ArgumentKindArrayInitializationValues
 | 
							section.value.kind == ArgumentKindArrayInitializationValues
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if !isComplexInitialization && section.value.value != nil {
 | 
				
			||||||
 | 
							output += " " + section.value.ToString(0, false)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						output += "\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for _, member := range section.what.members {
 | 
				
			||||||
 | 
							output += member.ToString(indent + 1)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if isComplexInitialization {
 | 
				
			||||||
 | 
							output += section.value.ToString(indent + 1, true)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	if section.external {
 | 
						if section.external {
 | 
				
			||||||
		output += "\n"
 | 
							output += "\n"
 | 
				
			||||||
		output += doIndent(indent + 1, "external\n")
 | 
							output += doIndent(indent + 1, "external\n")
 | 
				
			||||||
	} else if section.value.value == nil {
 | 
					 | 
				
			||||||
		output += "\n"
 | 
					 | 
				
			||||||
	} else if isComplexInitialization {
 | 
					 | 
				
			||||||
		output += "\n"
 | 
					 | 
				
			||||||
		output += section.value.ToString(indent + 1, true)
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		output += " " + section.value.ToString(0, false)
 | 
					 | 
				
			||||||
		output += "\n"
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return
 | 
						return
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (member TypeMember) ToString (indent int) (output string) {
 | 
				
			||||||
 | 
						output += doIndent(indent)
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						output += member.permission.ToString() + " "
 | 
				
			||||||
 | 
						output += member.name + ":"
 | 
				
			||||||
 | 
						output += member.what.ToString()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if member.bitWidth > 0 {
 | 
				
			||||||
 | 
							output += fmt.Sprint(" & ", member.bitWidth)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						output += "\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (section TypeSection) ToString (indent int) (output string) {
 | 
					func (section TypeSection) ToString (indent int) (output string) {
 | 
				
			||||||
	output += doIndent (
 | 
						output += doIndent (
 | 
				
			||||||
		indent,
 | 
							indent,
 | 
				
			||||||
@ -292,61 +313,23 @@ func (section TypeSection) ToString (indent int) (output string) {
 | 
				
			|||||||
	isComplexInitialization :=
 | 
						isComplexInitialization :=
 | 
				
			||||||
		section.value.kind == ArgumentKindObjectInitializationValues ||
 | 
							section.value.kind == ArgumentKindObjectInitializationValues ||
 | 
				
			||||||
		section.value.kind == ArgumentKindArrayInitializationValues
 | 
							section.value.kind == ArgumentKindArrayInitializationValues
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	if section.value.value == nil {
 | 
						if !isComplexInitialization && section.value.value != nil {
 | 
				
			||||||
		output += "\n"
 | 
					 | 
				
			||||||
	} else if isComplexInitialization {
 | 
					 | 
				
			||||||
		output += "\n"
 | 
					 | 
				
			||||||
		output += section.value.ToString(indent + 1, true)
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		output += " " + section.value.ToString(0, false)
 | 
							output += " " + section.value.ToString(0, false)
 | 
				
			||||||
		output += "\n"
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return
 | 
						output += "\n"
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (member ObjtMember) ToString (indent int) (output string) {
 | 
						for _, member := range section.what.members {
 | 
				
			||||||
	output += doIndent(indent)
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	output += member.permission.ToString() + " "
 | 
					 | 
				
			||||||
	output += member.name + ":"
 | 
					 | 
				
			||||||
	output += member.what.ToString()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if member.bitWidth > 0 {
 | 
					 | 
				
			||||||
		output += fmt.Sprint(" & ", member.bitWidth)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	isComplexInitialization :=
 | 
					 | 
				
			||||||
		member.value.kind == ArgumentKindObjectInitializationValues ||
 | 
					 | 
				
			||||||
		member.value.kind == ArgumentKindArrayInitializationValues
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	if member.value.value == nil {
 | 
					 | 
				
			||||||
		output += "\n"
 | 
					 | 
				
			||||||
	} else if isComplexInitialization {
 | 
					 | 
				
			||||||
		output += "\n"
 | 
					 | 
				
			||||||
		output += member.value.ToString(indent + 1, true)
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		output += " " + member.value.ToString(0, false)
 | 
					 | 
				
			||||||
		output += "\n"
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func (section ObjtSection) ToString (indent int) (output string) {
 | 
					 | 
				
			||||||
	output += doIndent (
 | 
					 | 
				
			||||||
		indent,
 | 
					 | 
				
			||||||
		"objt ",
 | 
					 | 
				
			||||||
		section.permission.ToString(), " ",
 | 
					 | 
				
			||||||
		section.name, ":",
 | 
					 | 
				
			||||||
		section.inherits.ToString(), "\n")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for _, member := range section.members {
 | 
					 | 
				
			||||||
		output += member.ToString(indent + 1)
 | 
							output += member.ToString(indent + 1)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if isComplexInitialization {
 | 
				
			||||||
 | 
							output += section.value.ToString(indent + 1, true)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return
 | 
						return
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (section EnumSection) ToString (indent int) (output string) {
 | 
					func (section EnumSection) ToString (indent int) (output string) {
 | 
				
			||||||
	output += doIndent (
 | 
						output += doIndent (
 | 
				
			||||||
		indent,
 | 
							indent,
 | 
				
			||||||
@ -410,6 +393,7 @@ func (phrase Phrase) ToString (indent int, ownLine bool) (output string) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var initializationValues Argument
 | 
						var initializationValues Argument
 | 
				
			||||||
 | 
						var declaration Argument
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	output += "[" + phrase.command.ToString(0, false)
 | 
						output += "[" + phrase.command.ToString(0, false)
 | 
				
			||||||
	for _, argument := range phrase.arguments {
 | 
						for _, argument := range phrase.arguments {
 | 
				
			||||||
@ -418,6 +402,8 @@ func (phrase Phrase) ToString (indent int, ownLine bool) (output string) {
 | 
				
			|||||||
			argument.kind == ArgumentKindArrayInitializationValues
 | 
								argument.kind == ArgumentKindArrayInitializationValues
 | 
				
			||||||
		if isInitializationValue {
 | 
							if isInitializationValue {
 | 
				
			||||||
			initializationValues = argument
 | 
								initializationValues = argument
 | 
				
			||||||
 | 
							} else if argument.kind == ArgumentKindDeclaration {
 | 
				
			||||||
 | 
								declaration = argument
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			output += " " + argument.ToString(0, false)
 | 
								output += " " + argument.ToString(0, false)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -433,6 +419,13 @@ func (phrase Phrase) ToString (indent int, ownLine bool) (output string) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if ownLine {
 | 
						if ownLine {
 | 
				
			||||||
		output += "\n"
 | 
							output += "\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// TODO: make = phrases special, have them carry a declaration
 | 
				
			||||||
 | 
							// and argument and nothing else. somehow.
 | 
				
			||||||
 | 
							for _, member := range declaration.value.(Declaration).what.members {
 | 
				
			||||||
 | 
								output += member.ToString(indent + 1)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		if initializationValues.kind != ArgumentKindNil {
 | 
							if initializationValues.kind != ArgumentKindNil {
 | 
				
			||||||
			output += initializationValues.ToString(indent + 1, true)
 | 
								output += initializationValues.ToString(indent + 1, true)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -47,11 +47,11 @@ type Identifier struct {
 | 
				
			|||||||
type TypeKind int
 | 
					type TypeKind int
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const (
 | 
					const (
 | 
				
			||||||
	// TypeKindBasic either means it's a primitive, or it inherits from
 | 
						// TypeKindBasic means its a normal type and inherits from something.
 | 
				
			||||||
	// something.
 | 
						// Basic types can define new members on their parent types.
 | 
				
			||||||
	TypeKindBasic TypeKind = iota
 | 
						TypeKindBasic TypeKind = iota
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TypeKindPointer means it's a pointer
 | 
						// TypeKindPointer means it's a pointer.
 | 
				
			||||||
	TypeKindPointer
 | 
						TypeKindPointer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TypeKindVariableArray means it's an array of variable length.
 | 
						// TypeKindVariableArray means it's an array of variable length.
 | 
				
			||||||
 | 
				
			|||||||
@ -19,7 +19,6 @@ type ro dInitInherit:aBasic
 | 
				
			|||||||
	-- that 9384
 | 
						-- that 9384
 | 
				
			||||||
	-- this 389
 | 
						-- this 389
 | 
				
			||||||
type ro eInitAndDefine:aBasic
 | 
					type ro eInitAndDefine:aBasic
 | 
				
			||||||
	-- this 389
 | 
					 | 
				
			||||||
	ro these:aBasic
 | 
						ro these:aBasic
 | 
				
			||||||
		ro born:Int 4
 | 
							ro born:Int 4
 | 
				
			||||||
		ro in:Int
 | 
							ro in:Int
 | 
				
			||||||
@ -27,6 +26,8 @@ type ro eInitAndDefine:aBasic
 | 
				
			|||||||
			9348
 | 
								9348
 | 
				
			||||||
			92384
 | 
								92384
 | 
				
			||||||
			92834
 | 
								92834
 | 
				
			||||||
 | 
						-- this 389
 | 
				
			||||||
 | 
						-- these
 | 
				
			||||||
		-- this 98
 | 
							-- this 98
 | 
				
			||||||
	-- that 9384
 | 
						-- that 9384
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user