jmespath / jmespath/jmespath.js

Parser incorrectly parses incomplete expression

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

Description

Tested with python and the `jp` CLI, incomplete expressions should generate an error. Note the delta here:

```
$ jp --ast 'foo.'
SyntaxError: Expected identifier, lbracket, or lbrace
foo.
^
```

```
>>> import jmespath
jmespath.exceptions.ParseError: Expecting: ['quoted_identifier', 'unquoted_identifier', 'lbracket', 'lbrace'], got: eof: Parse error at column 8, token "" (EOF), for expression:
"foo.bar."
^
>>>
```

But in javascript:

```

> var jmespath = require('./jmespath');
undefined
> jmespath.compile('foo.');
{ type: 'Subexpression',
children: [ { type: 'Field', name: 'foo' }, undefined ] }
```

Javascript should be raising an error here.

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.