diff --git a/parse.all.js b/parse.all.js index 0ede4f49..418b58c6 100644 --- a/parse.all.js +++ b/parse.all.js @@ -5,54 +5,62 @@ const unsign = require('./fiddle/unsign') const $ = require('programmatic') const vivify = require('./vivify') -function bff (path, fields, index = 0, rewind = 0) { - let checkpoint = { type: 'checkpoint', lengths: [ 0 ], rewind }, checked = [ checkpoint ] - for (const field of fields) { - switch (field.type) { - case 'function': - break - case 'conditional': - field.parse.sip = bff(path, field.parse.sip, index, rewind) - for (const condition of field.parse.conditions) { - condition.fields = bff(path, condition.fields, index, rewind) - } - break - case 'lengthEncoding': - checkpoint.lengths[0] += field.bits / 8 - break - case 'lengthEncoded': - checked.push(checkpoint = { type: 'checkpoint', lengths: [ 0 ], rewind: 0 }) - switch (field.element.type) { - case 'structure': - if (field.element.fixed) { +function map (packet, bff) { + let $i = -1, $sip = -1, $step = 1 + + const variables = { packet: true, step: true } + + function checkpoints (path, fields, index = 0, rewind = 0) { + let checkpoint = { type: 'checkpoint', lengths: [ 0 ], rewind }, checked = [ checkpoint ] + for (const field of fields) { + switch (field.type) { + case 'function': + break + case 'conditional': + variables.sip = true + field.parse.sip = checkpoints(path, field.parse.sip, index, rewind) + for (const condition of field.parse.conditions) { + condition.fields = checkpoints(path, condition.fields, index, rewind) + } + break + case 'lengthEncoding': + checkpoint.lengths[0] += field.bits / 8 + break + case 'lengthEncoded': + variables.i = true + variables.I = true + checked.push(checkpoint = { type: 'checkpoint', lengths: [ 0 ], rewind: 0 }) + switch (field.element.type) { + case 'structure': + if (field.element.fixed) { + checkpoint.lengths.push(`${field.element.bits / 8} * $I[${index}]`) + } else { + field.element.fields = checkpoints(path + `${field.dotted}[$i[${index}]]`, field.element.fields, index + 1) + } + break + default: checkpoint.lengths.push(`${field.element.bits / 8} * $I[${index}]`) - } else { - field.element.fields = bff(path + `${field.dotted}[$i[${index}]]`, field.element.fields, index + 1) + break } break + case 'terminated': + variables.i = true + break default: - checkpoint.lengths.push(`${field.element.bits / 8} * $I[${index}]`) + checkpoint.lengths[0] += field.bits / 8 break } - break - default: - checkpoint.lengths[0] += field.bits / 8 - break + checked.push(field) } - checked.push(field) + checked.forEach(field => { + if (field.type == 'checkpoint' && field.lengths[0] == 0) { + field.lengths.shift() + } + }) + return checked.filter(field => { + return field.type != 'checkpoint' || field.lengths.length != 0 + }) } - checked.forEach(field => { - if (field.type == 'checkpoint' && field.lengths[0] == 0) { - field.lengths.shift() - } - }) - return checked.filter(field => { - return field.type != 'checkpoint' || field.lengths.length != 0 - }) -} - -function map (packet, bff) { - let $i = -1, $sip = -1, step = 1, _conditional = false, _temporary = false function integer (assignee, field) { const variable = field.fields || field.compliment ? '$_' : assignee @@ -68,14 +76,14 @@ function map (packet, bff) { } bite += direction } - step += 2 + $step += 2 const parse = bytes == 1 ? `${variable} = ${reads.join('')}` : $(` ${variable} = `, reads.reverse().join(' +\n'), ` `) if (field.fields) { - _temporary = true + variables.register = true return $(` `, parse, ` @@ -84,7 +92,7 @@ function map (packet, bff) { } if (field.compliment) { - _temporary = true + variables.register = true return $(` `, parse, ` ${assignee} = ${unsign(variable, field.bits)} @@ -95,7 +103,9 @@ function map (packet, bff) { } function lengthEncoded (path, field) { - step += 1 + variables.i = true + variables.I = true + $step += 1 const i = `$i[${$i}]` const I = `$I[${$i}]` const looped = dispatch(path + `[${i}]`, field.element) @@ -116,6 +126,7 @@ function map (packet, bff) { } function terminated (path, field) { + variables.i = true $i++ const i = `$i[${$i}]` const looped = join(field.fields.map(field => dispatch(path + `[${i}]`, field))) @@ -160,9 +171,9 @@ function map (packet, bff) { function conditional (path, conditional) { $sip++ const block = [] - _conditional = true + variables.sip = true const sip = join(conditional.parse.sip.map(field => dispatch(`$sip[${$sip}]`, field))) - step++ + $step++ for (let i = 0, I = conditional.parse.conditions.length; i < I; i++) { const condition = conditional.parse.conditions[i] const source = join(condition.fields.map(field => dispatch(path, field))) @@ -184,16 +195,19 @@ function map (packet, bff) { } function checkpoint (checkpoint, depth, arrayed) { - const signature = [ packet.name, step ] if (checkpoint.lengths.length == 0) { return null } - if (packet.lengthEncoded) { - signature.push('$i', '$I') - } - if (_conditional) { - signature.push('$sip') + const signatories = { + packet: packet.name, + step: $step, + i: '$i', + I: '$I', + sip: '$sip' } + const signature = Object.keys(signatories) + .filter(key => variables[key]) + .map(key => signatories[key]) return $(` if ($end - $start < ${checkpoint.lengths.join(' + ')}) { return parsers.inc.${packet.name}(${signature.join(', ')})($buffer, $start, $end) @@ -223,7 +237,7 @@ function map (packet, bff) { case 'lengthEncoded': return lengthEncoded(path, field) case 'function': - step++ + $step++ return `${path} = (${field.source})($sip[${$sip}])` case 'literal': return $(` @@ -234,23 +248,25 @@ function map (packet, bff) { } } - const source = dispatch(packet.name, packet, true) - const variables = [] - if (packet.lengthEncoded || packet.arrayed) { - variables.push('$i = []', '$I = []') - } - if (_conditional) { - variables.push('$sip = []') - } - if (_temporary) { - variables.push('$_') + if (bff) { + packet.fields = checkpoints(packet.name, packet.fields) } + const source = dispatch(packet.name, packet, true) + const declarations = { + register: '$_', + i: '$i = []', + I: '$I = []', + sip: '$sip = []' + } + const lets = Object.keys(declarations) + .filter(key => variables[key]) + .map(key => declarations[key]) if (bff) { return $(` parsers.bff.${packet.name} = function () { return function parse ($buffer, $start, $end) { - `, variables.length ? `let ${variables.join(', ')}` : null, -1, ` + `, lets.length ? `let ${lets.join(', ')}` : null, -1, ` `, source, ` @@ -262,7 +278,7 @@ function map (packet, bff) { return $(` parsers.all.${packet.name} = function ($buffer, $start) { - `, variables.length ? `let ${variables.join(', ')}` : null, -1, ` + `, lets.length ? `let ${lets.join(', ')}` : null, -1, ` `, source, ` @@ -272,11 +288,5 @@ function map (packet, bff) { } module.exports = function (compiler, definition, options = {}) { - const source = join(JSON.parse(JSON.stringify(definition)).map(function (packet) { - if (options.bff) { - packet.fields = bff(packet.name, packet.fields) - } - return map(packet, options.bff) - })) - return compiler(source) + return compiler(join(JSON.parse(JSON.stringify(definition)).map(packet => map(packet, options.bff)))) } diff --git a/parse.inc.js b/parse.inc.js index 2e998c99..4b818f7b 100644 --- a/parse.inc.js +++ b/parse.inc.js @@ -6,18 +6,19 @@ const $ = require('programmatic') const vivify = require('./vivify') function generate (packet) { - let step = 0, $i = -1, $sip = -1, _conditional = false, _terminated = false + let $step = 0, $i = -1, $sip = -1, _conditional = false, _terminated = false + const lets = { packet: true, step: true } function integer (path, field) { const bytes = field.bits / 8 if (bytes == 1) { return $(` - case ${step++}: + case ${$step++}: - $step = ${step} + $step = ${$step} - case ${step++}: + case ${$step++}: if ($start == $end) { return { start: $start, object: null, parse } @@ -34,13 +35,13 @@ function generate (packet) { : field.compliment ? `${path} = ${unsign('$_', field.bits)}` : `${path} = $_` return $(` - case ${step++}: + case ${$step++}: $_ = 0 - $step = ${step} + $step = ${$step} $bite = ${start} - case ${step++}: + case ${$step++}: while ($bite != ${stop}) { if ($start == $end) { @@ -57,12 +58,12 @@ function generate (packet) { function literal (packet) { return $(` - case ${step++}: + case ${$step++}: $_ = ${packet.value.length / 2} - $step = ${step} + $step = ${$step} - case ${step++}: + case ${$step++}: $bite = Math.min($end - $start, $_) $_ -= $bite @@ -75,11 +76,13 @@ function generate (packet) { } function lengthEncoded (path, packet) { + lets.i = true + lets.I = true const i = `$i[${$i}]` const I = `$I[${$i}]` // var integer = integer(packet.length, 'length') // Invoked here to set `again`. - const again = step + const again = $step const source = $(` `, dispatch([ `${path}[${i}]` ], packet.element), ` if (++${i} != ${I}) { @@ -113,15 +116,16 @@ function generate (packet) { // it didn't match, I'd feed the array to the parser, this would handle long // weird terminators. function terminated (path, field) { + lets.i = true $i++ const i = `$i[${$i}]` _terminated = true - const init = step - let sip = ++step - const redo = step - const begin = step += field.terminator.length + const init = $step + let sip = ++$step + const redo = $step + const begin = $step += field.terminator.length const looped = join(field.fields.map(field => dispatch(`${path}[${i}]`, field))) - const stop = step + const stop = $step const literal = field.terminator.map(bite => `0x${bite.toString(16)}`) const terminator = join(field.terminator.map((bite, index) => { if (index != field.terminator.length - 1) { @@ -155,7 +159,7 @@ function generate (packet) { } $start++ - $step = ${step} + $step = ${$step} continue `) } @@ -177,15 +181,15 @@ function generate (packet) { } function conditional (path, conditional) { - _conditional = true + lets.sip = true $sip++ const { parse } = conditional const sip = join(parse.sip.map(field => dispatch(`$sip[${$sip}]`, field))) - const start = step++ + const start = $step++ const steps = [] for (const condition of parse.conditions) { steps.push({ - number: step, + number: $step, source: join(condition.fields.map(field => dispatch(path, field))) }) } @@ -202,7 +206,7 @@ function generate (packet) { `)) } const done = $(` - $step = ${step} + $step = ${$step} continue `) $sip-- @@ -227,12 +231,12 @@ function generate (packet) { switch (packet.type) { case 'structure': const push = $(` - case ${step++}: + case ${$step++}: ${path} = { `, vivify(packet.fields), ` } - $step = ${step} + $step = ${$step} `) const source = join(packet.fields.map(field => dispatch(path + field.dotted, field))) @@ -252,7 +256,7 @@ function generate (packet) { return integer(path, packet) case 'function': return $(` - case ${step++}: + case ${$step++}: ${path} = (${packet.source})($sip[0]) `) @@ -265,19 +269,23 @@ function generate (packet) { switch ($step) { `, dispatch(packet.name, packet, 0), ` - case ${step}: + case ${$step}: return { start: $start, object: ${packet.name}, parse: null } } `) - const lets = [ '$_', '$bite' ] - const signature = [ `${packet.name} = {}`, '$step = 0' ] - if (packet.lengthEncoded || _conditional || _terminated) { - signature.push('$i = []', '$I = []') - if (_conditional) { - signature.push('$sip = []') - } + const signatories = { + packet: `${packet.name} = {}`, + step: '$step = 0', + i: '$i = []', + I: '$I = []', + sip: '$sip = []' + } + const signature = Object.keys(signatories) + .filter(key => lets[key]) + .map(key => signatories[key]) + if (lets.i || lets.sip) { source = $(` for (;;) { `, source, ` @@ -291,7 +299,7 @@ function generate (packet) { const object = `parsers.inc.${packet.name}` return $(` ${object} = function (${signature.join(', ')}) { - let ${lets.join(', ')} + let $_, $bite return function parse ($buffer, $start, $end) { `, source, ` } diff --git a/serialize.all.js b/serialize.all.js index 942a3635..9b7dbdc7 100644 --- a/serialize.all.js +++ b/serialize.all.js @@ -40,7 +40,9 @@ function bff (path, fields, index = 0, rewind = 0) { } function generate (packet, bff) { - let step = 0, index = -1, _packed = false + let $step = 0, $i = -1 + + const variables = { packet: true, step: true } function word (asignee, field) { const bytes = field.bits / 8 @@ -57,9 +59,9 @@ function generate (packet, bff) { } function integer (path, field) { - step += 2 + $step += 2 if (field.fields) { - _packed = true + variables.register = true const packing = pack(field, path, '$_') return $(` `, packing, ` @@ -72,7 +74,8 @@ function generate (packet, bff) { } function lengthEncoded (path, field) { - const i = `$i[${++index}]` + variables.i = true + const i = `$i[${++$i}]` // TODO Here and in conditional we see that we know the name, but we // don't know really understand the contents of the packet, so we ought // to create the path with `concat` rather than have the packet @@ -83,19 +86,20 @@ function generate (packet, bff) { `, looped, ` } `) - index-- + $i-- return source } function lengthEncoding (path, field) { - step += 2 + $step += 2 return word(path + '.length', field) } function terminated (path, field) { - step += 2 - index++ - const i = `$i[${++index}]` + variables.i = true + $step += 2 + $i++ + const i = `$i[${++$i}]` const looped = join(field.fields.map(field => dispatch(path + `[${i}]`, field))) const terminator = [] for (const bite of field.terminator) { @@ -108,13 +112,13 @@ function generate (packet, bff) { `, terminator.join('\n'), ` `) - index-- + $i-- return source } function conditional (path, conditional) { const block = [] - step++ + $step++ for (let i = 0, I = conditional.serialize.conditions.length; i < I; i++) { const condition = conditional.serialize.conditions[i] const source = join(condition.fields.map(field => dispatch(path, field))) @@ -136,7 +140,7 @@ function generate (packet, bff) { if ($end - $start < ${checkpoint.lengths.join(' + ')}) { return { start: $start, - serialize: serializers.inc.object(${packet.name}, ${step - checkpoint.rewind}, ${i}) + serialize: serializers.inc.object(${packet.name}, ${$step - checkpoint.rewind}, ${i}) } } `) @@ -170,14 +174,15 @@ function generate (packet, bff) { } } - let source = dispatch(packet.name, packet) - const lets = [] - if (packet.lengthEncoded || packet.arrayed) { - lets.push('$i = []') - } - if (_packed) { - lets.push('$_') + const source = dispatch(packet.name, packet) + const declarations = { + register: '$_', + i: '$i = []', + sip: '$sip = []' } + const lets = Object.keys(declarations) + .filter(key => variables[key]) + .map(key => declarations[key]) return $(` serializers.${bff ? 'bff' : 'all'}.${packet.name} = function (${packet.name}) { return function ($buffer, $start, $end) { diff --git a/serialize.inc.js b/serialize.inc.js index 5477bd2e..24da3ae3 100644 --- a/serialize.inc.js +++ b/serialize.inc.js @@ -4,7 +4,9 @@ const snuggle = require('./snuggle') const pack = require('./pack') function generate (packet) { - let step = 0, index = -1, _conditional = false, _terminated = false + let $step = 0, $i = -1, surround = false + + const variables = { packet: true, step: true } function integer (path, field) { const endianness = field.endianness || 'big' @@ -14,13 +16,13 @@ function generate (packet) { let stop = field.endianness == 'big' ? -1 : bytes const assign = field.fields ? pack(field, path, '$_') : `$_ = ${path}` const source = $(` - case ${step++}: + case ${$step++}: - $step = ${step} + $step = ${$step} $bite = ${bite} `, assign, ` - case ${step++}: + case ${$step++}: while ($bite != ${stop}) { if ($start == $end) { @@ -40,13 +42,13 @@ function generate (packet) { bytes.push(parseInt(packet.value.substring(i, i + 2), 16)) } return $(` - case ${step++}: + case ${$step++}: - $step = ${step} + $step = ${$step} $bite = 0 $_ = ${JSON.stringify(bytes)} - case ${step++}: + case ${$step++}: while ($bite != ${packet.value.length / 2}) { if ($start == $end) { @@ -61,9 +63,11 @@ function generate (packet) { // TODO I don't need to push and pop $i. function lengthEncoded (path, packet) { - const i = `$i[${index}]` - const I = `$I[${index}]` - const again = step + variables.i = true + variables.I = true + const i = `$i[${$i}]` + const I = `$I[${$i}]` + const again = $step const source = $(` `, dispatch(`${path}[${i}]`, packet.element), ` @@ -74,12 +78,12 @@ function generate (packet) { $i.pop() `) - index-- + $i-- return source } function lengthEncoding (path, packet) { - index++ + $i++ return $(` `, integer(path + '.length', packet), ` $i.push(0) @@ -88,16 +92,16 @@ function generate (packet) { } function terminated (path, field) { - _terminated = true - index++ - const init = step - const again = ++step - const i = `$i[${index}]` + variables.i = true + $i++ + const init = $step + const again = ++$step + const i = `$i[${$i}]` const looped = join(field.fields.map(field => dispatch(`${path}[${i}]`, field))) - const done = step + const done = $step const terminator = join(field.terminator.map(bite => { return $(` - case ${step++}: + case ${$step++}: if ($start == $end) { return { start: $start, serialize } @@ -105,7 +109,7 @@ function generate (packet) { $buffer[$start++] = 0x${bite.toString(16)} - $step = ${step} + $step = ${$step} `) })) const source = $(` @@ -124,17 +128,17 @@ function generate (packet) { `, terminator, ` `) - index-- + $i-- return source } function conditional (path, conditional) { - _conditional = true - const start = step++ + surround = true + const start = $step++ const steps = [] for (const condition of conditional.serialize.conditions) { steps.push({ - step: step, + step: $step, source: join(condition.fields.map(field => dispatch(path, field))) }) } @@ -151,7 +155,7 @@ function generate (packet) { `)) } const done = $(` - $step = ${step} + $step = ${$step} continue `) // TODO Instead of choping the literal source, prevent adding the @@ -200,15 +204,15 @@ function generate (packet) { switch ($step) { `, dispatch(packet.name, packet), ` - $step = ${step} + $step = ${$step} - case ${step}: + case ${$step}: break } `) - if (packet.lengthEncoded || _conditional || _terminated) { + if (variables.i || surround) { source = $(` for (;;) { `, source, ` @@ -217,9 +221,20 @@ function generate (packet) { } `) } + + const signatories = { + packet: `${packet.name}`, + step: '$step = 0', + i: '$i = []', + I: '$I = []' + } + const signature = Object.keys(signatories) + .filter(key => variables[key]) + .map(key => signatories[key]) + const object = 'serializers.inc.' + packet.name const generated = $(` - ${object} = function (${packet.name}, $step = 0, $i = []) { + ${object} = function (${signature.join(', ')}) { let $bite, $stop, $_ return function serialize ($buffer, $start, $end) { diff --git a/test/generated/byte.serializer.inc.js b/test/generated/byte.serializer.inc.js index 0349e6d1..f3853743 100644 --- a/test/generated/byte.serializer.inc.js +++ b/test/generated/byte.serializer.inc.js @@ -1,5 +1,5 @@ module.exports = function (serializers) { - serializers.inc.object = function (object, $step = 0, $i = []) { + serializers.inc.object = function (object, $step = 0) { let $bite, $stop, $_ return function serialize ($buffer, $start, $end) { diff --git a/test/generated/length-encoded-fixed.serializer.inc.js b/test/generated/length-encoded-fixed.serializer.inc.js index e0207c34..c3dcd30d 100644 --- a/test/generated/length-encoded-fixed.serializer.inc.js +++ b/test/generated/length-encoded-fixed.serializer.inc.js @@ -1,5 +1,5 @@ module.exports = function (serializers) { - serializers.inc.object = function (object, $step = 0, $i = []) { + serializers.inc.object = function (object, $step = 0, $i = [], $I = []) { let $bite, $stop, $_ return function serialize ($buffer, $start, $end) { diff --git a/test/generated/length-encoded-variable.serializer.inc.js b/test/generated/length-encoded-variable.serializer.inc.js index d7baf382..b1fd6f99 100644 --- a/test/generated/length-encoded-variable.serializer.inc.js +++ b/test/generated/length-encoded-variable.serializer.inc.js @@ -1,5 +1,5 @@ module.exports = function (serializers) { - serializers.inc.object = function (object, $step = 0, $i = []) { + serializers.inc.object = function (object, $step = 0, $i = [], $I = []) { let $bite, $stop, $_ return function serialize ($buffer, $start, $end) { diff --git a/test/generated/length-encoded-words.serializer.inc.js b/test/generated/length-encoded-words.serializer.inc.js index 56e69e3f..3f3046a2 100644 --- a/test/generated/length-encoded-words.serializer.inc.js +++ b/test/generated/length-encoded-words.serializer.inc.js @@ -1,5 +1,5 @@ module.exports = function (serializers) { - serializers.inc.object = function (object, $step = 0, $i = []) { + serializers.inc.object = function (object, $step = 0, $i = [], $I = []) { let $bite, $stop, $_ return function serialize ($buffer, $start, $end) { diff --git a/test/generated/literal.serializer.inc.js b/test/generated/literal.serializer.inc.js index 2e4e27d1..25367e94 100644 --- a/test/generated/literal.serializer.inc.js +++ b/test/generated/literal.serializer.inc.js @@ -1,5 +1,5 @@ module.exports = function (serializers) { - serializers.inc.object = function (object, $step = 0, $i = []) { + serializers.inc.object = function (object, $step = 0) { let $bite, $stop, $_ return function serialize ($buffer, $start, $end) { diff --git a/test/generated/little.serializer.inc.js b/test/generated/little.serializer.inc.js index 7e1d1335..80bb2311 100644 --- a/test/generated/little.serializer.inc.js +++ b/test/generated/little.serializer.inc.js @@ -1,5 +1,5 @@ module.exports = function (serializers) { - serializers.inc.object = function (object, $step = 0, $i = []) { + serializers.inc.object = function (object, $step = 0) { let $bite, $stop, $_ return function serialize ($buffer, $start, $end) { diff --git a/test/generated/mysql.parser.inc.js b/test/generated/mysql.parser.inc.js index 7b7f3571..bde22b98 100644 --- a/test/generated/mysql.parser.inc.js +++ b/test/generated/mysql.parser.inc.js @@ -1,5 +1,5 @@ module.exports = function (parsers) { - parsers.inc.object = function (object = {}, $step = 0, $i = [], $I = [], $sip = []) { + parsers.inc.object = function (object = {}, $step = 0, $sip = []) { let $_, $bite return function parse ($buffer, $start, $end) { for (;;) { diff --git a/test/generated/mysql.serializer.inc.js b/test/generated/mysql.serializer.inc.js index f925bd05..bca1820a 100644 --- a/test/generated/mysql.serializer.inc.js +++ b/test/generated/mysql.serializer.inc.js @@ -1,5 +1,5 @@ module.exports = function (serializers) { - serializers.inc.object = function (object, $step = 0, $i = []) { + serializers.inc.object = function (object, $step = 0) { let $bite, $stop, $_ return function serialize ($buffer, $start, $end) { diff --git a/test/generated/negative-16bit.serializer.inc.js b/test/generated/negative-16bit.serializer.inc.js index aaa3bf4f..1af27f7a 100644 --- a/test/generated/negative-16bit.serializer.inc.js +++ b/test/generated/negative-16bit.serializer.inc.js @@ -1,5 +1,5 @@ module.exports = function (serializers) { - serializers.inc.object = function (object, $step = 0, $i = []) { + serializers.inc.object = function (object, $step = 0) { let $bite, $stop, $_ return function serialize ($buffer, $start, $end) { diff --git a/test/generated/negative-32bit.serializer.inc.js b/test/generated/negative-32bit.serializer.inc.js index 34495e4d..6d349995 100644 --- a/test/generated/negative-32bit.serializer.inc.js +++ b/test/generated/negative-32bit.serializer.inc.js @@ -1,5 +1,5 @@ module.exports = function (serializers) { - serializers.inc.object = function (object, $step = 0, $i = []) { + serializers.inc.object = function (object, $step = 0) { let $bite, $stop, $_ return function serialize ($buffer, $start, $end) { diff --git a/test/generated/packed.serializer.inc.js b/test/generated/packed.serializer.inc.js index 2de26b98..6c0d0fae 100644 --- a/test/generated/packed.serializer.inc.js +++ b/test/generated/packed.serializer.inc.js @@ -1,5 +1,5 @@ module.exports = function (serializers) { - serializers.inc.object = function (object, $step = 0, $i = []) { + serializers.inc.object = function (object, $step = 0) { let $bite, $stop, $_ return function serialize ($buffer, $start, $end) { diff --git a/test/generated/terminated.parser.all.js b/test/generated/terminated.parser.all.js index 6fb3f53b..1449570c 100644 --- a/test/generated/terminated.parser.all.js +++ b/test/generated/terminated.parser.all.js @@ -1,6 +1,6 @@ module.exports = function (parsers) { parsers.all.object = function ($buffer, $start) { - let $i = [], $I = [] + let $i = [] const object = { array: [] diff --git a/test/generated/terminated.parser.inc.js b/test/generated/terminated.parser.inc.js index 3e4c1d7b..6e79db67 100644 --- a/test/generated/terminated.parser.inc.js +++ b/test/generated/terminated.parser.inc.js @@ -1,5 +1,5 @@ module.exports = function (parsers) { - parsers.inc.object = function (object = {}, $step = 0, $i = [], $I = []) { + parsers.inc.object = function (object = {}, $step = 0, $i = []) { let $_, $bite return function parse ($buffer, $start, $end) { for (;;) { diff --git a/test/generated/word.serializer.inc.js b/test/generated/word.serializer.inc.js index 34495e4d..6d349995 100644 --- a/test/generated/word.serializer.inc.js +++ b/test/generated/word.serializer.inc.js @@ -1,5 +1,5 @@ module.exports = function (serializers) { - serializers.inc.object = function (object, $step = 0, $i = []) { + serializers.inc.object = function (object, $step = 0) { let $bite, $stop, $_ return function serialize ($buffer, $start, $end) {