jmespath / jmespath/jmespath.js

jmespath.js parser error showing undefined instead of actual token type and value

Open
#96 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
847
Forks
101
PR merge metrics
No merged PRs in 30d

Description

When the jmespath parser handles a syntax error related to parsing slice expressions, it's throwing an error message:
```
Syntax error: unexpected token: undefined(undefined)
```
Which, it should actually have token and value instead of `undefined`.

In the Parser's `_parseSliceExpression()` function, it looks like this:
```
var t = this._lookahead(0);
var error = new Error("Syntax error, unexpected token: " +
t.value + "(" + t.type + ")");
```

Solution: it should use `this._lookaheadToken()` instead of `this._lookahead()`. The this._lookaheadToken() will return a token object that will actually contain .type and .value properties

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.