Merge pull request #197 from sean-/f-stray-error

Return an error instead of printing stray `illegal\n` to stdout.
This commit is contained in:
Mitchell Hashimoto 2017-04-20 16:14:34 -07:00 committed by GitHub
commit 7fa7fff964

View File

@ -147,7 +147,7 @@ func (p *Parser) objectKey() ([]*ast.ObjectKey, error) {
// Done // Done
return keys, nil return keys, nil
case token.ILLEGAL: case token.ILLEGAL:
fmt.Println("illegal") return nil, errors.New("illegal")
default: default:
return nil, fmt.Errorf("expected: STRING got: %s", p.tok.Type) return nil, fmt.Errorf("expected: STRING got: %s", p.tok.Type)
} }