How to use the @phensley/cldr-ext-rbnf/lib/rbnftypes.Opcode.LITERAL function in @phensley/cldr-ext-rbnf

To help you get started, we’ve selected a few @phensley/cldr-ext-rbnf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github phensley / cldr-engine / packages / cldr-compiler / src / rbnf / encoder.ts View on Github external
private encodeNode(node: RBNFNode, symbols: string[]): any {
    switch (node.kind) {
        case 'literal': {
          const i = symbols.indexOf(node.n);
          return [Opcode.LITERAL, i];
        }

        case 'apply-left-rule': {
          const i = this.ruleindex(node.n);
          return [Opcode.APPLY_LEFT_RULE, i];
        }

        case 'apply-left-numfmt': {
          const i = this.index.get(node.n);
          return [Opcode.APPLY_LEFT_NUM_FORMAT, i];
        }

        case 'apply-left-2-rule': {
          const i = this.ruleindex(node.n);
          return [Opcode.APPLY_LEFT_2_RULE, i];
        }