Small parser and ToString fixes

This commit is contained in:
Sasha Koshka 2022-10-13 00:18:32 -04:00
parent c290b3a3d7
commit ae50fab159
3 changed files with 11 additions and 4 deletions

View File

@ -39,13 +39,16 @@ func (member ObjectMember) ToString (indent int) (output string) {
indent, "member ",
member.permission.ToString(), " ",
member.name)
if member.bitWidth > 0 {
output += fmt.Sprint(" width ", member.bitWidth)
}
output += "\n"
output += member.what.ToString(indent + 1)
if member.argument != nil {
output += member.argument.ToString(indent + 1)
}
return
}

View File

@ -101,7 +101,8 @@ func (parser *parsingOperation) parseTypeSectionMember () (
// see if value exists
if parser.token.Is(lexer.TokenKindNewline) {
parser.nextToken()
err = parser.nextToken()
if err != nil { return }
// if we have exited the member, return
if !parser.token.Is(lexer.TokenKindIndent) { return }
if parser.token.Value().(int) != 2 { return }

View File

@ -7,7 +7,10 @@ type ro aBasicInt:Int 5
type ro bOnBasicInt:aBasicInt
type ro cBasicObject:Obj
ro that:Int
ro that:UInt
ro this:Int
type ro dInheritedFromOther:something.Thing
type ro eInheritObject:cBasicObject
rw that