Skip to content

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

@David-Yuen

Description

@David-Yuen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions