Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const i = symbols.indexOf(n.n);
block.push([cat, i]);
}
return node.kind === 'cardinal' ? [Opcode.CARDINAL, block] : [Opcode.ORDINAL, block];
}
case 'optional': {
const block = node.n.map(n => this.encodeNode(n, symbols));
return [Opcode.OPTIONAL, block];
}
case 'sub-left':
return [Opcode.SUB_LEFT];
case 'sub-right':
return [Opcode.SUB_RIGHT];
case 'sub-right-3':
return [Opcode.SUB_RIGHT_3];
}
throw new Error(`No encoder for node: ${JSON.stringify(node)}`);
}