Skip to content

Commit

Permalink
feat: remove .<field> accessor
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Nov 11, 2021
1 parent 6b5e77d commit 251e383
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/grammar.ne
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ side ->
| query {% d => ({field: '<implicit>', ...d[0]}) %}

field ->
[._a-zA-Z$] [a-zA-Z\d_$.]:* {% d => d[0] + d[1].join('') %}
[_a-zA-Z$] [a-zA-Z\d_$.]:* {% d => d[0] + d[1].join('') %}
| sqstring {% id %}
| dqstring {% id %}

Expand Down
2 changes: 1 addition & 1 deletion src/grammar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ const grammar: Grammar = {
{"name": "side", "symbols": ["query"], "postprocess": d => ({field: '<implicit>', ...d[0]})},
{"name": "field$ebnf$1", "symbols": []},
{"name": "field$ebnf$1", "symbols": ["field$ebnf$1", /[a-zA-Z\d_$.]/], "postprocess": (d) => d[0].concat([d[1]])},
{"name": "field", "symbols": [/[._a-zA-Z$]/, "field$ebnf$1"], "postprocess": d => d[0] + d[1].join('')},
{"name": "field", "symbols": [/[_a-zA-Z$]/, "field$ebnf$1"], "postprocess": d => d[0] + d[1].join('')},
{"name": "field", "symbols": ["sqstring"], "postprocess": id},
{"name": "field", "symbols": ["dqstring"], "postprocess": id},
{"name": "query", "symbols": ["relational_operator", "_", "decimal"], "postprocess": d => ({quoted: false, query: d[2], relationalOperator: d[0][0]})},
Expand Down
2 changes: 2 additions & 0 deletions test/liqe/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ test('"member"', testQuery, ['robert']);
test('tags:"member"', testQuery, ['robert']);

test('"London"', testQuery, ['mike']);
test('city:"London"', testQuery, []);
test('location.city:"London"', testQuery, ['mike']);

test('membership:null', testQuery, ['noah']);
test('attributes.member:null', testQuery, ['noah']);

test('subscribed:true', testQuery, ['noah']);

Expand Down
8 changes: 0 additions & 8 deletions test/liqe/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,6 @@ test('foo:bar', testQuery, {
query: 'bar',
});

test('.foo:bar', testQuery, {
field: '.foo',
fieldPath: [
'foo',
],
query: 'bar',
});

test('foo: bar', testQuery, {
field: 'foo',
query: 'bar',
Expand Down

0 comments on commit 251e383

Please sign in to comment.