Fixed some test case formatting
This commit is contained in:
parent
cced825f74
commit
ef90115a1b
@ -115,22 +115,16 @@ func TestType (test *testing.T) {
|
|||||||
:arf
|
:arf
|
||||||
---
|
---
|
||||||
type ro Basic:Int
|
type ro Basic:Int
|
||||||
|
|
||||||
type ro BasicInit:Int 6
|
type ro BasicInit:Int 6
|
||||||
|
|
||||||
type ro IntArray:{Int ..}
|
type ro IntArray:{Int ..}
|
||||||
|
|
||||||
type ro IntArrayInit:{Int 3}
|
type ro IntArrayInit:{Int 3}
|
||||||
3298 923 92
|
3298 923 92
|
||||||
|
|
||||||
type ro Complex:Obj
|
type ro Complex:Obj
|
||||||
ro that:Basic
|
ro that:Basic
|
||||||
ro this:Basic
|
ro this:Basic
|
||||||
|
|
||||||
type ro ComplexInit:Obj
|
type ro ComplexInit:Obj
|
||||||
ro that:BasicInit
|
ro that:BasicInit
|
||||||
ro this:Basic 23
|
ro this:Basic 23
|
||||||
|
|
||||||
type ro ComplexWithComplexInit
|
type ro ComplexWithComplexInit
|
||||||
ro basic:Basic 87
|
ro basic:Basic 87
|
||||||
ro complex0:Complex
|
ro complex0:Complex
|
||||||
|
@ -261,7 +261,11 @@ func (section *TypeSection) ToString (indent int) (output string) {
|
|||||||
section.inherits.ToString())
|
section.inherits.ToString())
|
||||||
|
|
||||||
if section.defaultValue.value == nil {
|
if section.defaultValue.value == nil {
|
||||||
|
if len(section.members) > 0 {
|
||||||
// TODO: print out members
|
// TODO: print out members
|
||||||
|
} else {
|
||||||
|
output += "\n"
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
output += " " + section.defaultValue.ToString(0, false)
|
output += " " + section.defaultValue.ToString(0, false)
|
||||||
output += "\n"
|
output += "\n"
|
||||||
|
@ -1,8 +1,50 @@
|
|||||||
package parser
|
package parser
|
||||||
|
|
||||||
|
import "git.tebibyte.media/sashakoshka/arf/types"
|
||||||
|
import "git.tebibyte.media/sashakoshka/arf/lexer"
|
||||||
|
// import "git.tebibyte.media/sashakoshka/arf/infoerr"
|
||||||
|
|
||||||
func (parser *ParsingOperation) parseTypeSection () (
|
func (parser *ParsingOperation) parseTypeSection () (
|
||||||
section *TypeSection,
|
section *TypeSection,
|
||||||
err error,
|
err error,
|
||||||
) {
|
) {
|
||||||
|
err = parser.expect(lexer.TokenKindName)
|
||||||
|
if err != nil { return }
|
||||||
|
|
||||||
|
section = &TypeSection { location: parser.token.Location() }
|
||||||
|
|
||||||
|
// get permission
|
||||||
|
err = parser.nextToken(lexer.TokenKindPermission)
|
||||||
|
if err != nil { return }
|
||||||
|
section.permission = parser.token.Value().(types.Permission)
|
||||||
|
|
||||||
|
// get name
|
||||||
|
err = parser.nextToken(lexer.TokenKindName)
|
||||||
|
if err != nil { return }
|
||||||
|
section.name = parser.token.Value().(string)
|
||||||
|
|
||||||
|
// get inherited type
|
||||||
|
err = parser.nextToken(lexer.TokenKindColon)
|
||||||
|
if err != nil { return }
|
||||||
|
err = parser.nextToken()
|
||||||
|
if err != nil { return }
|
||||||
|
section.inherits, err = parser.parseType()
|
||||||
|
if err != nil { return }
|
||||||
|
|
||||||
|
if parser.token.Is(lexer.TokenKindNewline) {
|
||||||
|
err = parser.nextToken()
|
||||||
|
if err != nil { return }
|
||||||
|
|
||||||
|
// section.value, err = parser.parseInitializationValues(0)
|
||||||
|
// if err != nil { return }
|
||||||
|
} else {
|
||||||
|
section.defaultValue, err = parser.parseArgument()
|
||||||
|
if err != nil { return }
|
||||||
|
|
||||||
|
err = parser.expect(lexer.TokenKindNewline)
|
||||||
|
if err != nil { return }
|
||||||
|
err = parser.nextToken()
|
||||||
|
if err != nil { return }
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user