@malloydata/motly-ts-parser 0.0.1 → 0.0.2

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/build/parser.js +15 -3
  2. package/package.json +1 -1
package/build/parser.js CHANGED
@@ -80,13 +80,25 @@ class Parser {
80
80
  }
81
81
  }
82
82
  }
83
+ /**
84
+ * Like `skipWs`, but also eats commas. Used in statement-list
85
+ * contexts (top-level document and properties blocks) so commas
86
+ * can serve as optional separators between statements.
87
+ */
88
+ skipWsAndCommas() {
89
+ this.skipWs();
90
+ while (this.peekChar() === ",") {
91
+ this.advance(1);
92
+ this.skipWs();
93
+ }
94
+ }
83
95
  // ── Statement Dispatch ──────────────────────────────────────────
84
96
  parseStatements() {
85
97
  const statements = [];
86
- this.skipWs();
98
+ this.skipWsAndCommas();
87
99
  while (this.pos < this.input.length) {
88
100
  statements.push(this.parseStatement());
89
- this.skipWs();
101
+ this.skipWsAndCommas();
90
102
  }
91
103
  return statements;
92
104
  }
@@ -775,7 +787,7 @@ class Parser {
775
787
  }
776
788
  const stmts = [];
777
789
  for (;;) {
778
- this.skipWs();
790
+ this.skipWsAndCommas();
779
791
  if (this.eatChar("}"))
780
792
  return stmts;
781
793
  if (this.pos >= this.input.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/motly-ts-parser",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "MOTLY text to wire format parser — pure TypeScript",
5
5
  "license": "MIT",
6
6
  "main": "build/index.js",