@intend-it/parser 1.1.4 → 1.1.5

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.
Files changed (2) hide show
  1. package/dist/index.js +16 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9331,6 +9331,14 @@ class IntendParser extends CstParser {
9331
9331
  { ALT: () => this.CONSUME(Let) }
9332
9332
  ]);
9333
9333
  this.CONSUME(Identifier, { LABEL: "ResultVar" });
9334
+ this.OPTION2(() => {
9335
+ this.CONSUME(Colon);
9336
+ this.CONSUME2(Identifier, { LABEL: "ResultType" });
9337
+ this.OPTION3(() => {
9338
+ this.CONSUME(LBracket);
9339
+ this.CONSUME(RBracket);
9340
+ });
9341
+ });
9334
9342
  });
9335
9343
  });
9336
9344
  ensureStatement = this.RULE("ensureStatement", () => {
@@ -9462,11 +9470,18 @@ class IntendASTVisitor extends BaseIntendVisitor {
9462
9470
  const instruction = this.unquoteString(rawString);
9463
9471
  const resultVariable = ctx.ResultVar ? ctx.ResultVar[0].image : undefined;
9464
9472
  const variableKind = ctx.Let && ctx.Let.length > 0 ? "let" : "const";
9473
+ let resultType;
9474
+ if (ctx.ResultType) {
9475
+ const base = ctx.ResultType[0].image;
9476
+ const isArray2 = ctx.LBracket && ctx.LBracket.length > 0;
9477
+ resultType = isArray2 ? `${base}[]` : base;
9478
+ }
9465
9479
  return {
9466
9480
  type: "Step",
9467
9481
  instruction,
9468
9482
  resultVariable,
9469
- variableKind
9483
+ variableKind,
9484
+ resultType
9470
9485
  };
9471
9486
  }
9472
9487
  returnStatement(ctx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intend-it/parser",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Parser for the Intend programming language",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",