Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
David-Yuen opened this issue Feb 29, 2024 · 0 comments

Comments

@David-Yuen
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant