Fixed data section parsing

This commit is contained in:
Sasha Koshka 2022-09-27 18:42:00 -04:00
parent 93bc742339
commit 6c70e9c50d

View File

@ -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 }
// 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 }
// check if data is external
if parser.token.Is(lexer.TokenKindIndent) &&
parser.token.Value().(int) == 1 {
err = parser.nextToken(lexer.TokenKindName)
err = parser.nextToken()
if err != nil { return }
if parser.token.Value().(string) == "external" {
}
// 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 }
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
}