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/dist/flowquery.min.js +1 -1
- package/dist/parsing/parser.js +1 -1
- package/dist/parsing/parser.js.map +1 -1
- package/docs/flowquery.min.js +1 -1
- package/flowquery-py/pyproject.toml +1 -1
- package/flowquery-py/src/parsing/parser.py +1 -1
- package/flowquery-py/tests/parsing/test_parser.py +37 -0
- package/flowquery-vscode/flowQueryEngine/flowquery.min.js +1 -1
- package/package.json +1 -1
- package/src/parsing/parser.ts +1 -1
- package/tests/parsing/parser.test.ts +36 -0
package/package.json
CHANGED
package/src/parsing/parser.ts
CHANGED
|
@@ -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.
|
|
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(
|