Skip to content

Commit

Permalink
Fix panic on a syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
nihei9 committed Aug 15, 2021
1 parent 05738fa commit 118732e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions driver/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,11 @@ func (p *Parser) Parse() error {
eKinds, eof := p.expectedKinds(p.top())

var b strings.Builder
fmt.Fprintf(&b, "%v", eKinds[0])
for _, k := range eKinds[1:] {
fmt.Fprintf(&b, ", %v", k)
if len(eKinds) > 0 {
fmt.Fprintf(&b, "%v", eKinds[0])
for _, k := range eKinds[1:] {
fmt.Fprintf(&b, ", %v", k)
}
}
if eof {
if len(eKinds) > 0 {
Expand Down

0 comments on commit 118732e

Please sign in to comment.