@gmb/bitmark-parser 3.0.2 → 3.0.3

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,59 +86,65 @@ function getStringFromWasm0(ptr, len) {
86
86
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
87
87
  }
88
88
  /**
89
- * Lex bitmark input text, returning one line per token in the same format as
90
- * the Rust CLI: `{kind:?} {span:?} "{text}"`.
89
+ * Breakscape text (escape bitmark special characters).
91
90
  *
92
- * `stage` selects the lexer pipeline:
93
- * - `"lex"` — combined (default)
94
- * - `"lex-json"` — combined, JSON array output
91
+ * `format`: `"bitmark++"` (default) or `"plainText"`
92
+ * `location`: `"body"` (default) or `"tag"`
95
93
  * @param {string} input
96
- * @param {string} stage
94
+ * @param {string} format
95
+ * @param {string} location
97
96
  * @returns {string}
98
97
  */
99
- module.exports.lex = function(input, stage) {
100
- let deferred3_0;
101
- let deferred3_1;
98
+ module.exports.breakscape_text = function(input, format, location) {
99
+ let deferred4_0;
100
+ let deferred4_1;
102
101
  try {
103
102
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
104
103
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
105
104
  const len0 = WASM_VECTOR_LEN;
106
- const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
105
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
107
106
  const len1 = WASM_VECTOR_LEN;
108
- wasm.lex(retptr, ptr0, len0, ptr1, len1);
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);
109
110
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
110
111
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
111
- deferred3_0 = r0;
112
- deferred3_1 = r1;
112
+ deferred4_0 = r0;
113
+ deferred4_1 = r1;
113
114
  return getStringFromWasm0(r0, r1);
114
115
  } finally {
115
116
  wasm.__wbindgen_add_to_stack_pointer(16);
116
- wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
117
+ wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
117
118
  }
118
119
  };
119
120
 
120
121
  /**
121
- * Breakscape text (escape bitmark special characters).
122
+ * Query information about supported bit types.
122
123
  *
123
- * `format`: `"bitmark++"` (default) or `"plainText"`
124
- * `location`: `"body"` (default) or `"tag"`
125
- * @param {string} input
124
+ * `info_type`: `"list"`, `"bit"`, `"all"`, or `"deprecated"`
125
+ * `format`: `"text"` or `"json"`
126
+ * `bit`: bit name (required when `info_type` is `"bit"`)
127
+ * `pretty`: whether to pretty-print JSON output
128
+ * `indent`: indent size for pretty-printing (default: 2)
129
+ * @param {string} info_type
126
130
  * @param {string} format
127
- * @param {string} location
131
+ * @param {string} bit
132
+ * @param {boolean} pretty
133
+ * @param {number} indent
128
134
  * @returns {string}
129
135
  */
130
- module.exports.breakscape_text = function(input, format, location) {
136
+ module.exports.info = function(info_type, format, bit, pretty, indent) {
131
137
  let deferred4_0;
132
138
  let deferred4_1;
133
139
  try {
134
140
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
135
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
141
+ const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
136
142
  const len0 = WASM_VECTOR_LEN;
137
143
  const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
138
144
  const len1 = WASM_VECTOR_LEN;
139
- const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
145
+ const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
140
146
  const len2 = WASM_VECTOR_LEN;
141
- wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
147
+ wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);
142
148
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
143
149
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
144
150
  deferred4_0 = r0;
@@ -151,25 +157,16 @@ module.exports.breakscape_text = function(input, format, location) {
151
157
  };
152
158
 
153
159
  /**
154
- * Auto-detect input format and convert between bitmark and JSON.
160
+ * Parse bitmark input text and return the reference JSON format.
155
161
  *
156
- * `mode`: `"optimized"` (default) or `"full"`
157
- * `warnings`: whether to include validation warnings (default: false)
158
- * `plain_text`: output text as plain text — debug mode (default: false)
159
- * `pretty`: prettify JSON output (default: false)
160
- * `indent`: indent size for pretty-printing (default: 2)
162
+ * Uses the full pipeline: parse → validate → serialize.
161
163
  *
162
- * Returns JSON if input is bitmark, or an error message if input is JSON
163
- * (generator not yet implemented).
164
+ * `mode`: `"optimized"` (default) or `"full"`
164
165
  * @param {string} input
165
166
  * @param {string} mode
166
- * @param {boolean} warnings
167
- * @param {boolean} plain_text
168
- * @param {boolean} pretty
169
- * @param {number} indent
170
167
  * @returns {string}
171
168
  */
172
- module.exports.convert = function(input, mode, warnings, plain_text, pretty, indent) {
169
+ module.exports.parse = function(input, mode) {
173
170
  let deferred3_0;
174
171
  let deferred3_1;
175
172
  try {
@@ -178,7 +175,7 @@ module.exports.convert = function(input, mode, warnings, plain_text, pretty, ind
178
175
  const len0 = WASM_VECTOR_LEN;
179
176
  const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
180
177
  const len1 = WASM_VECTOR_LEN;
181
- wasm.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);
178
+ wasm.parse(retptr, ptr0, len0, ptr1, len1);
182
179
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
183
180
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
184
181
  deferred3_0 = r0;
@@ -191,40 +188,34 @@ module.exports.convert = function(input, mode, warnings, plain_text, pretty, ind
191
188
  };
192
189
 
193
190
  /**
194
- * Query information about supported bit types.
191
+ * Lex bitmark input text, returning one line per token in the same format as
192
+ * the Rust CLI: `{kind:?} {span:?} "{text}"`.
195
193
  *
196
- * `info_type`: `"list"`, `"bit"`, `"all"`, or `"deprecated"`
197
- * `format`: `"text"` or `"json"`
198
- * `bit`: bit name (required when `info_type` is `"bit"`)
199
- * `pretty`: whether to pretty-print JSON output
200
- * `indent`: indent size for pretty-printing (default: 2)
201
- * @param {string} info_type
202
- * @param {string} format
203
- * @param {string} bit
204
- * @param {boolean} pretty
205
- * @param {number} indent
194
+ * `stage` selects the lexer pipeline:
195
+ * - `"lex"` — combined (default)
196
+ * - `"lex-json"` — combined, JSON array output
197
+ * @param {string} input
198
+ * @param {string} stage
206
199
  * @returns {string}
207
200
  */
208
- module.exports.info = function(info_type, format, bit, pretty, indent) {
209
- let deferred4_0;
210
- let deferred4_1;
201
+ module.exports.lex = function(input, stage) {
202
+ let deferred3_0;
203
+ let deferred3_1;
211
204
  try {
212
205
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
213
- const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
206
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
214
207
  const len0 = WASM_VECTOR_LEN;
215
- const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
208
+ const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
216
209
  const len1 = WASM_VECTOR_LEN;
217
- const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
218
- const len2 = WASM_VECTOR_LEN;
219
- wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);
210
+ wasm.lex(retptr, ptr0, len0, ptr1, len1);
220
211
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
221
212
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
222
- deferred4_0 = r0;
223
- deferred4_1 = r1;
213
+ deferred3_0 = r0;
214
+ deferred3_1 = r1;
224
215
  return getStringFromWasm0(r0, r1);
225
216
  } finally {
226
217
  wasm.__wbindgen_add_to_stack_pointer(16);
227
- wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
218
+ wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
228
219
  }
229
220
  };
230
221
 
@@ -262,16 +253,25 @@ module.exports.unbreakscape_text = function(input, format, location) {
262
253
  };
263
254
 
264
255
  /**
265
- * Parse bitmark input text and return the reference JSON format.
266
- *
267
- * Uses the full pipeline: parse → validate → serialize.
256
+ * Auto-detect input format and convert between bitmark and JSON.
268
257
  *
269
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).
270
266
  * @param {string} input
271
267
  * @param {string} mode
268
+ * @param {boolean} warnings
269
+ * @param {boolean} plain_text
270
+ * @param {boolean} pretty
271
+ * @param {number} indent
272
272
  * @returns {string}
273
273
  */
274
- module.exports.parse = function(input, mode) {
274
+ module.exports.convert = function(input, mode, warnings, plain_text, pretty, indent) {
275
275
  let deferred3_0;
276
276
  let deferred3_1;
277
277
  try {
@@ -280,7 +280,7 @@ module.exports.parse = function(input, mode) {
280
280
  const len0 = WASM_VECTOR_LEN;
281
281
  const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
282
282
  const len1 = WASM_VECTOR_LEN;
283
- wasm.parse(retptr, ptr0, len0, ptr1, len1);
283
+ wasm.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);
284
284
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
285
285
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
286
286
  deferred3_0 = r0;
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.2",
7
+ "version": "3.0.3",
8
8
  "license": "ISC",
9
9
  "repository": {
10
10
  "type": "git",