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 () (
section *TypeSection,
err error,
) {
err = parser.expect(lexer.TokenKindName)
if err != nil { return }
section = &TypeSection { location: parser.token.Location() }
// get permission
err = parser.nextToken(lexer.TokenKindPermission)
section.permission = parser.token.Value().(types.Permission)
// get name
err = parser.nextToken(lexer.TokenKindName)
section.name = parser.token.Value().(string)
// get inherited type
err = parser.nextToken(lexer.TokenKindColon)
err = parser.nextToken()
section.inherits, err = parser.parseType()
if parser.token.Is(lexer.TokenKindNewline) {
// section.value, err = parser.parseInitializationValues(0)
// if err != nil { return }
} else {
section.defaultValue, err = parser.parseArgument()
err = parser.expect(lexer.TokenKindNewline)
}
return