flowquery 1.0.23 → 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowquery",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "A declarative query language for data processing pipelines.",
5
5
  "main": "dist/index.node.js",
6
6
  "types": "dist/index.node.d.ts",
@@ -857,7 +857,7 @@ class Parser extends BaseParser {
857
857
  while (true) {
858
858
  if (this.token.isDot()) {
859
859
  this.setNextToken();
860
- if (!this.token.isIdentifierOrKeyword()) {
860
+ if (!this.token.isIdentifier() && !this.token.isKeyword()) {
861
861
  throw new Error("Expected identifier");
862
862
  }
863
863
  lookup = new Lookup();
@@ -264,6 +264,42 @@ test("Test lookup with JSON array", () => {
264
264
  expect(_return.firstChild().value()).toBe(2);
265
265
  });
266
266
 
267
+ test("Test lookup with reserved keyword property names", () => {
268
+ const parser = new Parser();
269
+ const ast = parser.parse("with {end: 1, null: 2, case: 3} as x return x.end, x.null, x.case");
270
+ expect(ast.print()).toBe(
271
+ "ASTNode\n" +
272
+ "- With\n" +
273
+ "-- Expression (x)\n" +
274
+ "--- AssociativeArray\n" +
275
+ "---- KeyValuePair\n" +
276
+ "----- String (end)\n" +
277
+ "----- Expression\n" +
278
+ "------ Number (1)\n" +
279
+ "---- KeyValuePair\n" +
280
+ "----- String (null)\n" +
281
+ "----- Expression\n" +
282
+ "------ Number (2)\n" +
283
+ "---- KeyValuePair\n" +
284
+ "----- String (case)\n" +
285
+ "----- Expression\n" +
286
+ "------ Number (3)\n" +
287
+ "- Return\n" +
288
+ "-- Expression\n" +
289
+ "--- Lookup\n" +
290
+ "---- Identifier (end)\n" +
291
+ "---- Reference (x)\n" +
292
+ "-- Expression\n" +
293
+ "--- Lookup\n" +
294
+ "---- Identifier (null)\n" +
295
+ "---- Reference (x)\n" +
296
+ "-- Expression\n" +
297
+ "--- Lookup\n" +
298
+ "---- Identifier (case)\n" +
299
+ "---- Reference (x)"
300
+ );
301
+ });
302
+
267
303
  test("Test load with post", () => {
268
304
  const parser = new Parser();
269
305
  const ast = parser.parse(