@graffiticode/basis 1.5.15 → 1.5.17

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/package.json +1 -1
  2. package/src/compiler.js +17 -3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@graffiticode/basis",
3
3
  "type": "module",
4
- "version": "1.5.15",
4
+ "version": "1.5.17",
5
5
  "description": "The basis library for creating Graffiticode languages",
6
6
  "main": "index.js",
7
7
  "scripts": {
package/src/compiler.js CHANGED
@@ -97,6 +97,11 @@ export class Checker extends Visitor {
97
97
  resume(err, data);
98
98
  });
99
99
  }
100
+ CATCH_ALL(node, options, resume) {
101
+ const err = [];
102
+ const val = node;
103
+ resume(err, val);
104
+ }
100
105
  ERROR(node, options, resume) {
101
106
  this.visit(node.elts[0], options, (e0, v0) => {
102
107
  this.visit(node.elts[1], options, (e1, v1) => {
@@ -498,7 +503,7 @@ export class Transformer extends Visitor {
498
503
  }
499
504
  const patternNid = this.internPattern(pattern);
500
505
  if (patternNid === this.internPattern(node) ||
501
- patternNid === this.internPattern(newNode('IDENT', ['_']))) {
506
+ patternNid === this.internPattern(newNode('_', []))) {
502
507
  return true;
503
508
  }
504
509
  if (pattern.tag === node.tag) {
@@ -536,7 +541,11 @@ export class Transformer extends Visitor {
536
541
  // }
537
542
  return matches;
538
543
  }
539
-
544
+ CATCH_ALL(node, options, resume) {
545
+ const err = [];
546
+ const val = node; // Use the node as the tag value.
547
+ resume(err, val);
548
+ }
540
549
  PROG(node, options, resume) {
541
550
  if (!options) {
542
551
  options = {};
@@ -842,6 +851,10 @@ export class Transformer extends Visitor {
842
851
  this.visit(node.elts[1], options, (e1, v1) => {
843
852
  let err = [];
844
853
  let val = [];
854
+ console.log(
855
+ "MAP()",
856
+ "v1=" + JSON.stringify(v1),
857
+ );
845
858
  v1.forEach(args => {
846
859
  options.args = args;
847
860
  options = JSON.parse(JSON.stringify(options)); // Copy option arg support async.
@@ -916,7 +929,8 @@ export class Transformer extends Visitor {
916
929
  const type = typeof v0;
917
930
  const val = `${v0}`;
918
931
  const expr = (
919
- val === null && {tag: "NUL", elts: []} ||
932
+ v0 === null && {tag: "NUL", elts: []} ||
933
+ v0.tag !== undefined && v0 || // We've got a tag value.
920
934
  type === "boolean" && {tag: "BOOL", elts: [val]} ||
921
935
  type === "number" && {tag: "NUM", elts: [val]} ||
922
936
  {tag: "STR", elts: [val]}