type-section-rework #6

Merged
sashakoshka merged 46 commits from type-section-rework into main 2022-09-17 10:36:27 -06:00
2 changed files with 22 additions and 10 deletions
Showing only changes of commit 5b627f8995 - Show all commits

View File

@ -35,16 +35,28 @@ func (parser *ParsingOperation) parseDataSection () (
return
}
// check if data is external
if parser.token.Is(lexer.TokenKindName) &&
parser.token.Value().(string) == "external" {
err = parser.expect(lexer.TokenKindNewline)
if err != nil { return }
err = parser.nextToken()
if err != nil { return }
section.external = true
err = parser.nextToken(lexer.TokenKindNewline)
// check if data is external
if parser.token.Is(lexer.TokenKindIndent) &&
parser.token.Value().(int) == 1 {
err = parser.nextToken(lexer.TokenKindName)
if err != nil { return }
err = parser.nextToken()
if err != nil { return }
return
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()
}
return
}

View File

@ -128,7 +128,7 @@ func (what Type) ToString (indent int) (output string) {
output += what.defaultValue.ToString(indent, true)
} else {
output += ":<"
output += what.defaultValue.ToString(indent, true)
output += what.defaultValue.ToString(indent, false)
output += ">\n"
}
}
@ -269,7 +269,7 @@ func (argument Argument) ToString (indent int, breakLine bool) (output string) {
func (section DataSection) ToString (indent int) (output string) {
output += doIndent (
indent,
"type ",
"data ",
section.permission.ToString(), " ",
section.name, ":",
section.what.ToString(indent), "\n")