@gmb/bitmark-parser 6.0.0 → 6.0.1

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.
@@ -85,76 +85,6 @@ function getStringFromWasm0(ptr, len) {
85
85
  ptr = ptr >>> 0;
86
86
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
87
87
  }
88
- /**
89
- * Lex bitmark input text, returning one line per token in the same format as
90
- * the Rust CLI: `{kind:?} {span:?} "{text}"`.
91
- *
92
- * `stage` selects the lexer pipeline:
93
- * - `"lex"` — combined (default)
94
- * - `"lex-json"` — combined, JSON array output
95
- * @param {string} input
96
- * @param {string} stage
97
- * @returns {string}
98
- */
99
- module.exports.lex = function(input, stage) {
100
- let deferred3_0;
101
- let deferred3_1;
102
- try {
103
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
104
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
105
- const len0 = WASM_VECTOR_LEN;
106
- const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
107
- const len1 = WASM_VECTOR_LEN;
108
- wasm.lex(retptr, ptr0, len0, ptr1, len1);
109
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
110
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
111
- deferred3_0 = r0;
112
- deferred3_1 = r1;
113
- return getStringFromWasm0(r0, r1);
114
- } finally {
115
- wasm.__wbindgen_add_to_stack_pointer(16);
116
- wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
117
- }
118
- };
119
-
120
- /**
121
- * Query information about supported bit types.
122
- *
123
- * `info_type`: `"list"`, `"bit"`, `"all"`, or `"deprecated"`
124
- * `format`: `"text"` or `"json"`
125
- * `bit`: bit name (required when `info_type` is `"bit"`)
126
- * `pretty`: whether to pretty-print JSON output
127
- * `indent`: indent size for pretty-printing (default: 2)
128
- * @param {string} info_type
129
- * @param {string} format
130
- * @param {string} bit
131
- * @param {boolean} pretty
132
- * @param {number} indent
133
- * @returns {string}
134
- */
135
- module.exports.info = function(info_type, format, bit, pretty, indent) {
136
- let deferred4_0;
137
- let deferred4_1;
138
- try {
139
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
140
- const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
141
- const len0 = WASM_VECTOR_LEN;
142
- const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
143
- const len1 = WASM_VECTOR_LEN;
144
- const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
145
- const len2 = WASM_VECTOR_LEN;
146
- wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);
147
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
148
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
149
- deferred4_0 = r0;
150
- deferred4_1 = r1;
151
- return getStringFromWasm0(r0, r1);
152
- } finally {
153
- wasm.__wbindgen_add_to_stack_pointer(16);
154
- wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
155
- }
156
- };
157
-
158
88
  /**
159
89
  * Unbreakscape text (unescape bitmark special characters).
160
90
  *
@@ -189,16 +119,25 @@ module.exports.unbreakscape_text = function(input, format, location) {
189
119
  };
190
120
 
191
121
  /**
192
- * Parse bitmark input text and return the reference JSON format.
193
- *
194
- * Uses the full pipeline: parse → validate → serialize.
122
+ * Auto-detect input format and convert between bitmark and JSON.
195
123
  *
196
124
  * `mode`: `"optimized"` (default) or `"full"`
125
+ * `warnings`: whether to include validation warnings (default: false)
126
+ * `plain_text`: output text as plain text — debug mode (default: false)
127
+ * `pretty`: prettify JSON output (default: false)
128
+ * `indent`: indent size for pretty-printing (default: 2)
129
+ *
130
+ * Returns JSON if input is bitmark, or an error message if input is JSON
131
+ * (generator not yet implemented).
197
132
  * @param {string} input
198
133
  * @param {string} mode
134
+ * @param {boolean} warnings
135
+ * @param {boolean} plain_text
136
+ * @param {boolean} pretty
137
+ * @param {number} indent
199
138
  * @returns {string}
200
139
  */
201
- module.exports.parse = function(input, mode) {
140
+ module.exports.convert = function(input, mode, warnings, plain_text, pretty, indent) {
202
141
  let deferred3_0;
203
142
  let deferred3_1;
204
143
  try {
@@ -207,7 +146,7 @@ module.exports.parse = function(input, mode) {
207
146
  const len0 = WASM_VECTOR_LEN;
208
147
  const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
209
148
  const len1 = WASM_VECTOR_LEN;
210
- wasm.parse(retptr, ptr0, len0, ptr1, len1);
149
+ wasm.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);
211
150
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
212
151
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
213
152
  deferred3_0 = r0;
@@ -220,34 +159,26 @@ module.exports.parse = function(input, mode) {
220
159
  };
221
160
 
222
161
  /**
223
- * Auto-detect input format and convert between bitmark and JSON.
224
- *
225
- * `mode`: `"optimized"` (default) or `"full"`
226
- * `warnings`: whether to include validation warnings (default: false)
227
- * `plain_text`: output text as plain text — debug mode (default: false)
228
- * `pretty`: prettify JSON output (default: false)
229
- * `indent`: indent size for pretty-printing (default: 2)
162
+ * Lex bitmark input text, returning one line per token in the same format as
163
+ * the Rust CLI: `{kind:?} {span:?} "{text}"`.
230
164
  *
231
- * Returns JSON if input is bitmark, or an error message if input is JSON
232
- * (generator not yet implemented).
165
+ * `stage` selects the lexer pipeline:
166
+ * - `"lex"` — combined (default)
167
+ * - `"lex-json"` — combined, JSON array output
233
168
  * @param {string} input
234
- * @param {string} mode
235
- * @param {boolean} warnings
236
- * @param {boolean} plain_text
237
- * @param {boolean} pretty
238
- * @param {number} indent
169
+ * @param {string} stage
239
170
  * @returns {string}
240
171
  */
241
- module.exports.convert = function(input, mode, warnings, plain_text, pretty, indent) {
172
+ module.exports.lex = function(input, stage) {
242
173
  let deferred3_0;
243
174
  let deferred3_1;
244
175
  try {
245
176
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
246
177
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
247
178
  const len0 = WASM_VECTOR_LEN;
248
- const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
179
+ const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
249
180
  const len1 = WASM_VECTOR_LEN;
250
- wasm.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);
181
+ wasm.lex(retptr, ptr0, len0, ptr1, len1);
251
182
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
252
183
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
253
184
  deferred3_0 = r0;
@@ -292,6 +223,75 @@ module.exports.breakscape_text = function(input, format, location) {
292
223
  }
293
224
  };
294
225
 
226
+ /**
227
+ * Query information about supported bit types.
228
+ *
229
+ * `info_type`: `"list"`, `"bit"`, `"all"`, or `"deprecated"`
230
+ * `format`: `"text"` or `"json"`
231
+ * `bit`: bit name (required when `info_type` is `"bit"`)
232
+ * `pretty`: whether to pretty-print JSON output
233
+ * `indent`: indent size for pretty-printing (default: 2)
234
+ * @param {string} info_type
235
+ * @param {string} format
236
+ * @param {string} bit
237
+ * @param {boolean} pretty
238
+ * @param {number} indent
239
+ * @returns {string}
240
+ */
241
+ module.exports.info = function(info_type, format, bit, pretty, indent) {
242
+ let deferred4_0;
243
+ let deferred4_1;
244
+ try {
245
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
246
+ const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
247
+ const len0 = WASM_VECTOR_LEN;
248
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
249
+ const len1 = WASM_VECTOR_LEN;
250
+ const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
251
+ const len2 = WASM_VECTOR_LEN;
252
+ wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);
253
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
254
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
255
+ deferred4_0 = r0;
256
+ deferred4_1 = r1;
257
+ return getStringFromWasm0(r0, r1);
258
+ } finally {
259
+ wasm.__wbindgen_add_to_stack_pointer(16);
260
+ wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
261
+ }
262
+ };
263
+
264
+ /**
265
+ * Parse bitmark input text and return the reference JSON format.
266
+ *
267
+ * Uses the full pipeline: parse → validate → serialize.
268
+ *
269
+ * `mode`: `"optimized"` (default) or `"full"`
270
+ * @param {string} input
271
+ * @param {string} mode
272
+ * @returns {string}
273
+ */
274
+ module.exports.parse = function(input, mode) {
275
+ let deferred3_0;
276
+ let deferred3_1;
277
+ try {
278
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
279
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
280
+ const len0 = WASM_VECTOR_LEN;
281
+ const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
282
+ const len1 = WASM_VECTOR_LEN;
283
+ wasm.parse(retptr, ptr0, len0, ptr1, len1);
284
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
285
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
286
+ deferred3_0 = r0;
287
+ deferred3_1 = r1;
288
+ return getStringFromWasm0(r0, r1);
289
+ } finally {
290
+ wasm.__wbindgen_add_to_stack_pointer(16);
291
+ wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
292
+ }
293
+ };
294
+
295
295
  const path = require('path').join(__dirname, 'bitmark_wasm_bg.wasm');
296
296
  const bytes = require('fs').readFileSync(path);
297
297
 
Binary file
package/wasm/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "Get More Brain Ltd <info@getmorebrain.com>"
5
5
  ],
6
6
  "description": "WebAssembly bindings for the bitmark parser",
7
- "version": "6.0.0",
7
+ "version": "6.0.1",
8
8
  "license": "ISC",
9
9
  "repository": {
10
10
  "type": "git",