Skip to content

Commit

Permalink
fix(parser): Corrige erro de token desconhecido ao criar lista vazia
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfeitosa committed Mar 3, 2024
1 parent d621bf3 commit 46d4b92
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -839,16 +839,20 @@ func (p *Parser) parseAtomo() (BaseNode, error) {
return tupla, nil
case lexer.TokenAbreColchetes:
literal := &ListaLiteral{}
p.avancar()

for p.token.Tipo != lexer.TokenFechaColchetes {
p.avancar()
exp, err := p.parseExpressao()

if err != nil {
return nil, err
}

literal.Elementos = append(literal.Elementos, exp)

if p.token.Tipo == lexer.TokenVirgula {
p.avancar()
}
}

p.avancar()
Expand Down

0 comments on commit 46d4b92

Please sign in to comment.