@gmb/bitmark-parser 3.0.3 → 6.0.0

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.
@@ -86,35 +86,34 @@ function getStringFromWasm0(ptr, len) {
86
86
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
87
87
  }
88
88
  /**
89
- * Breakscape text (escape bitmark special characters).
89
+ * Lex bitmark input text, returning one line per token in the same format as
90
+ * the Rust CLI: `{kind:?} {span:?} "{text}"`.
90
91
  *
91
- * `format`: `"bitmark++"` (default) or `"plainText"`
92
- * `location`: `"body"` (default) or `"tag"`
92
+ * `stage` selects the lexer pipeline:
93
+ * - `"lex"` — combined (default)
94
+ * - `"lex-json"` — combined, JSON array output
93
95
  * @param {string} input
94
- * @param {string} format
95
- * @param {string} location
96
+ * @param {string} stage
96
97
  * @returns {string}
97
98
  */
98
- module.exports.breakscape_text = function(input, format, location) {
99
- let deferred4_0;
100
- let deferred4_1;
99
+ module.exports.lex = function(input, stage) {
100
+ let deferred3_0;
101
+ let deferred3_1;
101
102
  try {
102
103
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
103
104
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
104
105
  const len0 = WASM_VECTOR_LEN;
105
- const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
106
+ const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
106
107
  const len1 = WASM_VECTOR_LEN;
107
- const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
108
- const len2 = WASM_VECTOR_LEN;
109
- wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
108
+ wasm.lex(retptr, ptr0, len0, ptr1, len1);
110
109
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
111
110
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
112
- deferred4_0 = r0;
113
- deferred4_1 = r1;
111
+ deferred3_0 = r0;
112
+ deferred3_1 = r1;
114
113
  return getStringFromWasm0(r0, r1);
115
114
  } finally {
116
115
  wasm.__wbindgen_add_to_stack_pointer(16);
117
- wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
116
+ wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
118
117
  }
119
118
  };
120
119
 
@@ -156,6 +155,39 @@ module.exports.info = function(info_type, format, bit, pretty, indent) {
156
155
  }
157
156
  };
158
157
 
158
+ /**
159
+ * Unbreakscape text (unescape bitmark special characters).
160
+ *
161
+ * `format`: `"bitmark++"` (default) or `"plainText"`
162
+ * `location`: `"body"` (default) or `"tag"`
163
+ * @param {string} input
164
+ * @param {string} format
165
+ * @param {string} location
166
+ * @returns {string}
167
+ */
168
+ module.exports.unbreakscape_text = function(input, format, location) {
169
+ let deferred4_0;
170
+ let deferred4_1;
171
+ try {
172
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
173
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
174
+ const len0 = WASM_VECTOR_LEN;
175
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
176
+ const len1 = WASM_VECTOR_LEN;
177
+ const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
178
+ const len2 = WASM_VECTOR_LEN;
179
+ wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
180
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
181
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
182
+ deferred4_0 = r0;
183
+ deferred4_1 = r1;
184
+ return getStringFromWasm0(r0, r1);
185
+ } finally {
186
+ wasm.__wbindgen_add_to_stack_pointer(16);
187
+ wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
188
+ }
189
+ };
190
+
159
191
  /**
160
192
  * Parse bitmark input text and return the reference JSON format.
161
193
  *
@@ -188,26 +220,34 @@ module.exports.parse = function(input, mode) {
188
220
  };
189
221
 
190
222
  /**
191
- * Lex bitmark input text, returning one line per token in the same format as
192
- * the Rust CLI: `{kind:?} {span:?} "{text}"`.
223
+ * Auto-detect input format and convert between bitmark and JSON.
193
224
  *
194
- * `stage` selects the lexer pipeline:
195
- * - `"lex"` — combined (default)
196
- * - `"lex-json"` — combined, JSON array output
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)
230
+ *
231
+ * Returns JSON if input is bitmark, or an error message if input is JSON
232
+ * (generator not yet implemented).
197
233
  * @param {string} input
198
- * @param {string} stage
234
+ * @param {string} mode
235
+ * @param {boolean} warnings
236
+ * @param {boolean} plain_text
237
+ * @param {boolean} pretty
238
+ * @param {number} indent
199
239
  * @returns {string}
200
240
  */
201
- module.exports.lex = function(input, stage) {
241
+ module.exports.convert = function(input, mode, warnings, plain_text, pretty, indent) {
202
242
  let deferred3_0;
203
243
  let deferred3_1;
204
244
  try {
205
245
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
206
246
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
207
247
  const len0 = WASM_VECTOR_LEN;
208
- const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
248
+ const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
209
249
  const len1 = WASM_VECTOR_LEN;
210
- wasm.lex(retptr, ptr0, len0, ptr1, len1);
250
+ wasm.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);
211
251
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
212
252
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
213
253
  deferred3_0 = r0;
@@ -220,7 +260,7 @@ module.exports.lex = function(input, stage) {
220
260
  };
221
261
 
222
262
  /**
223
- * Unbreakscape text (unescape bitmark special characters).
263
+ * Breakscape text (escape bitmark special characters).
224
264
  *
225
265
  * `format`: `"bitmark++"` (default) or `"plainText"`
226
266
  * `location`: `"body"` (default) or `"tag"`
@@ -229,7 +269,7 @@ module.exports.lex = function(input, stage) {
229
269
  * @param {string} location
230
270
  * @returns {string}
231
271
  */
232
- module.exports.unbreakscape_text = function(input, format, location) {
272
+ module.exports.breakscape_text = function(input, format, location) {
233
273
  let deferred4_0;
234
274
  let deferred4_1;
235
275
  try {
@@ -240,7 +280,7 @@ module.exports.unbreakscape_text = function(input, format, location) {
240
280
  const len1 = WASM_VECTOR_LEN;
241
281
  const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
242
282
  const len2 = WASM_VECTOR_LEN;
243
- wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
283
+ wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
244
284
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
245
285
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
246
286
  deferred4_0 = r0;
@@ -252,46 +292,6 @@ module.exports.unbreakscape_text = function(input, format, location) {
252
292
  }
253
293
  };
254
294
 
255
- /**
256
- * Auto-detect input format and convert between bitmark and JSON.
257
- *
258
- * `mode`: `"optimized"` (default) or `"full"`
259
- * `warnings`: whether to include validation warnings (default: false)
260
- * `plain_text`: output text as plain text — debug mode (default: false)
261
- * `pretty`: prettify JSON output (default: false)
262
- * `indent`: indent size for pretty-printing (default: 2)
263
- *
264
- * Returns JSON if input is bitmark, or an error message if input is JSON
265
- * (generator not yet implemented).
266
- * @param {string} input
267
- * @param {string} mode
268
- * @param {boolean} warnings
269
- * @param {boolean} plain_text
270
- * @param {boolean} pretty
271
- * @param {number} indent
272
- * @returns {string}
273
- */
274
- module.exports.convert = function(input, mode, warnings, plain_text, pretty, indent) {
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.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);
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": "3.0.3",
7
+ "version": "6.0.0",
8
8
  "license": "ISC",
9
9
  "repository": {
10
10
  "type": "git",