@gi-tcg/gts-transpiler 0.3.9 → 0.3.10

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/index.js CHANGED
@@ -68,8 +68,8 @@ function loosePlugin() {
68
68
  return function loosePluginTransformer(parser) {
69
69
  return class LooseParser extends parser {
70
70
  _patchedParseIdent = (liberal) => {
71
- if (this.type !== tokTypes.name) return this.createDummyIdentifier();
72
- else return super.parseIdent(liberal);
71
+ if (this.type === tokTypes.name || this.type.keyword) return super.parseIdent(liberal);
72
+ else return this.createDummyIdentifier();
73
73
  };
74
74
  #proxiedThis = new Proxy(this, { get: (target, prop) => {
75
75
  if (prop === "parseIdent") return this._patchedParseIdent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gi-tcg/gts-transpiler",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/piovium/gts.git"
@@ -1,7 +1,7 @@
1
1
  import { tokTypes, type Parser } from "acorn";
2
2
  import type { AST, Parse } from "../types.js";
3
3
 
4
- export const DUMMY_PLACEHOLDER = '';
4
+ export const DUMMY_PLACEHOLDER = "";
5
5
 
6
6
  export function loosePlugin() {
7
7
  return function loosePluginTransformer(parser: typeof Parser): typeof Parser {
@@ -9,10 +9,10 @@ export function loosePlugin() {
9
9
  private readonly _patchedParseIdent = (
10
10
  liberal?: boolean,
11
11
  ): AST.Identifier => {
12
- if (this.type !== tokTypes.name) {
13
- return this.createDummyIdentifier();
14
- } else {
12
+ if (this.type === tokTypes.name || this.type.keyword) {
15
13
  return super.parseIdent(liberal);
14
+ } else {
15
+ return this.createDummyIdentifier();
16
16
  }
17
17
  };
18
18
  readonly #proxiedThis = new Proxy(this, {
@@ -29,7 +29,10 @@ export function loosePlugin() {
29
29
  });
30
30
 
31
31
  createDummyIdentifier() {
32
- const dummy = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc) as AST.Identifier;
32
+ const dummy = this.startNodeAt(
33
+ this.lastTokEnd,
34
+ this.lastTokEndLoc,
35
+ ) as AST.Identifier;
33
36
  dummy.name = DUMMY_PLACEHOLDER;
34
37
  dummy.isDummy = true;
35
38
  return this.finishNode(dummy, "Identifier");