Skip to content

Commit

Permalink
Address reviews
Browse files Browse the repository at this point in the history
Signed-off-by: Charith Ellawala <[email protected]>
  • Loading branch information
charithe committed Dec 2, 2024
1 parent 48f0004 commit b5fa18f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@ func (p *parser) parseDocumentBody(ctx *context) (ast.Node, error) {
}

func (p *parser) parseToken(ctx *context, tk *Token) (ast.Node, error) {
if tk == nil {
return nil, nil
}

switch tk.GroupType() {
case TokenGroupMapKey, TokenGroupMapKeyValue:
return p.parseMap(ctx)
Expand Down Expand Up @@ -1067,12 +1063,12 @@ func (p *parser) parseDirective(ctx *context, g *TokenGroup) (*ast.DirectiveNode

func (p *parser) parseComment(ctx *context) (ast.Node, error) {
cm := p.parseHeadComment(ctx)
nextTok := ctx.currentToken()
if nextTok == nil {
tk := ctx.currentToken()
if tk == nil {
return cm, nil
}

node, err := p.parseToken(ctx, nextTok)
node, err := p.parseToken(ctx, tk)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit b5fa18f

Please sign in to comment.