Type attributes can have whitespace before them

By type attributes I mean things like :mut :N :<defaultValue>.
After the colon and before the attribute, whitespace is now
permitted. This makes syntax like

data ro nIntegerArrayInitialized:Int:16:mut:
	<3948 293 293049 948 912
	340 0 2304 0 4785 92>

possible.
This commit is contained in:
Sasha Koshka 2022-09-16 22:22:07 -04:00
parent f2f6e2f3d3
commit e123e97357
2 changed files with 9 additions and 5 deletions

View File

@ -42,8 +42,13 @@ func (parser *ParsingOperation) parseType () (what Type, err error) {
for {
if !parser.token.Is(lexer.TokenKindColon) { break }
err = parser.nextToken()
if err != nil { return }
err = parser.skipWhitespace()
if err != nil { return }
err = parser.nextToken(
err = parser.expect(
lexer.TokenKindName,
lexer.TokenKindUInt,
lexer.TokenKindLParen,

View File

@ -41,7 +41,6 @@ data ro lMutIntegerArray16:Int:16:mut
data ro mExternalData:Int:8
external
data ro nIntegerArrayInitialized:Int:16:mut:<
3948 293 293049 948 912
340 0 2304 0 4785 92
>
data ro nIntegerArrayInitialized:Int:16:mut:
<3948 293 293049 948 912
340 0 2304 0 4785 92>