diff --git a/parser/data.go b/parser/data.go index 313a909..27a23c0 100644 --- a/parser/data.go +++ b/parser/data.go @@ -35,28 +35,37 @@ func (parser *ParsingOperation) parseDataSection () ( return } - err = parser.expect(lexer.TokenKindNewline) - if err != nil { return } - err = parser.nextToken() - if err != nil { return } - - // check if data is external - if parser.token.Is(lexer.TokenKindIndent) && - parser.token.Value().(int) == 1 { + // see if value exists + if parser.token.Is(lexer.TokenKindNewline) { + parser.nextToken() + // if we have exited the member, return + if !parser.token.Is(lexer.TokenKindIndent) { return } + if parser.token.Value().(int) != 1 { return } - err = parser.nextToken(lexer.TokenKindName) + err = parser.nextToken() if err != nil { return } + } + + // check if external + if parser.token.Is(lexer.TokenKindName) { if parser.token.Value().(string) == "external" { - section.external = true + err = parser.nextToken(lexer.TokenKindNewline) - if err != nil { return } + if err != nil { return } err = parser.nextToken() if err != nil { return } return } - - parser.previousToken() } + + // get value + section.argument, err = parser.parseArgument() + err = parser.expect(lexer.TokenKindNewline) + if err != nil { return } + + err = parser.nextToken() + if err != nil { return } + return }