From 870a33f4c227a20d3598e368934588ea63838f21 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 27 Sep 2022 17:00:44 -0400 Subject: [PATCH] Untested, updated enum parsing --- parser/enum.go | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/parser/enum.go b/parser/enum.go index c2427d9..bd0cd7d 100644 --- a/parser/enum.go +++ b/parser/enum.go @@ -91,32 +91,19 @@ func (parser *ParsingOperation) parseEnumMember () ( member.name = parser.token.Value().(string) // see if value exists - err = parser.nextToken ( - lexer.TokenKindColon, - lexer.TokenKindNewline) + err = parser.nextToken() if err != nil { return } - - if parser.token.Is(lexer.TokenKindColon) { - err = parser.nextToken() - if err != nil { return } - err = parser.skipWhitespace() - if err != nil { return } - err = parser.expect ( - lexer.TokenKindLessThan, - lexer.TokenKindLParen) - if err != nil { return } - - if parser.token.Is(lexer.TokenKindLessThan) { - // parse value - member.value, err = parser.parseBasicDefaultValue() - if err != nil { return } - - } else if parser.token.Is(lexer.TokenKindLParen) { - // parse default values - member.value, err = parser.parseObjectDefaultValue() - if err != nil { return } - } + 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) != 2 { return } } + // get value + member.argument, err = parser.parseArgument() + err = parser.expect(lexer.TokenKindNewline) + if err != nil { return } + return }