parseType method now understands arrays with undefined length

This commit is contained in:
Sasha Koshka 2022-08-16 20:55:43 -04:00
parent 97cb6e54eb
commit 210e527b3a

View File

@ -90,7 +90,8 @@ func (parser *ParsingOperation) parseType () (what Type, err error) {
err = parser.expect (
lexer.TokenKindUInt,
lexer.TokenKindRBrace)
lexer.TokenKindRBrace,
lexer.TokenKindElipsis)
if err != nil { return }
if parser.token.Is(lexer.TokenKindUInt) {
@ -98,6 +99,11 @@ func (parser *ParsingOperation) parseType () (what Type, err error) {
what.length = parser.token.Value().(uint64)
err = parser.nextToken(lexer.TokenKindRBrace)
if err != nil { return }
} else if parser.token.Is(lexer.TokenKindElipsis) {
what.kind = TypeKindArray
err = parser.nextToken(lexer.TokenKindRBrace)
if err != nil { return }
}