enum-section #6
@ -68,6 +68,8 @@ func (parser *ParsingOperation) parseEnumMembers (
|
|||||||
err = parser.nextToken(lexer.TokenKindName)
|
err = parser.nextToken(lexer.TokenKindName)
|
||||||
if err != nil { return }
|
if err != nil { return }
|
||||||
name := parser.token.Value().(string)
|
name := parser.token.Value().(string)
|
||||||
|
err = parser.nextToken()
|
||||||
|
if err != nil { return }
|
||||||
|
|
||||||
// parse default value
|
// parse default value
|
||||||
var argument Argument
|
var argument Argument
|
||||||
|
@ -335,19 +335,19 @@ func (section *EnumSection) ToString (indent int) (output string) {
|
|||||||
for _, name := range sortMapKeysAlphabetically(section.members) {
|
for _, name := range sortMapKeysAlphabetically(section.members) {
|
||||||
output += doIndent(indent, name, " ")
|
output += doIndent(indent, name, " ")
|
||||||
|
|
||||||
member := section.members[name]
|
defaultValue := section.members[name]
|
||||||
|
|
||||||
isComplexInitialization :=
|
isComplexInitialization :=
|
||||||
member.kind == ArgumentKindObjectInitializationValues ||
|
defaultValue.kind == ArgumentKindObjectInitializationValues ||
|
||||||
member.kind == ArgumentKindArrayInitializationValues
|
defaultValue.kind == ArgumentKindArrayInitializationValues
|
||||||
|
|
||||||
if member.value == nil {
|
if defaultValue.value == nil {
|
||||||
output += "\n"
|
output += "\n"
|
||||||
} else if isComplexInitialization {
|
} else if isComplexInitialization {
|
||||||
output += "\n"
|
output += "\n"
|
||||||
output += member.ToString(indent + 1, true)
|
output += defaultValue.ToString(indent + 1, true)
|
||||||
} else {
|
} else {
|
||||||
output += " " + member.ToString(0, false)
|
output += " " + defaultValue.ToString(0, false)
|
||||||
output += "\n"
|
output += "\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user