@phensley/cldr-ext-rbnf
Advanced tools
Comparing version 1.2.13 to 1.2.14
import { Decimal } from '@phensley/decimal'; | ||
import { PluralRules } from '@phensley/plurals'; | ||
import { RuleType, RBNFRule } from './rbnftypes'; | ||
import { RBNFRule } from './rbnftypes'; | ||
import { RBNF as RBNFBase, RBNFDecimalFormatter, RBNFSet as RBNFSetBase, RBNFSymbols } from './rbnf'; | ||
@@ -5,0 +5,0 @@ export interface RBNFDebugSettings { |
/* istanbul ignore file */ | ||
var _a, _b; | ||
import { __extends, __spreadArrays } from "tslib"; | ||
import { __extends, __spreadArray } from "tslib"; | ||
import { RBNF as RBNFBase, RBNFEngine as RBNFEngineBase, RBNFSet as RBNFSetBase, } from './rbnf'; | ||
@@ -58,3 +58,3 @@ var REVPLURALS = { | ||
pct = (count / rules.length) * 100; | ||
console.log(padleft(Math.floor(pct) + "%", 6), '[', padleft("" + count, 2), '/', padleft("" + rules.length, 2), ']', name_1); | ||
console.log(padleft("".concat(Math.floor(pct), "%"), 6), '[', padleft("".concat(count), 2), '/', padleft("".concat(rules.length), 2), ']', name_1); | ||
if (detail && pct < 100) { | ||
@@ -92,3 +92,3 @@ console.log(rpt); | ||
} | ||
var id = "" + padleft("[" + this.id + "]", 5); | ||
var id = "".concat(padleft("[".concat(this.id, "]"), 5)); | ||
var indent = ' '.repeat(this.depth); | ||
@@ -98,3 +98,3 @@ this.id++; | ||
if (this.settings.trace) { | ||
console.log.apply(console, __spreadArrays([indent, id, '>>'], s)); | ||
console.log.apply(console, __spreadArray([indent, id, '>>'], s, false)); | ||
} | ||
@@ -121,3 +121,3 @@ return function () { | ||
if (this.settings.trace) { | ||
t = this.trace("_evalinst '" + n.toString() + "' " + this.rbnf.allnames[si] + " " + rulerepr(this.rbnf, r)); | ||
t = this.trace("_evalinst '".concat(n.toString(), "' ").concat(this.rbnf.allnames[si], " ").concat(rulerepr(this.rbnf, r))); | ||
} | ||
@@ -139,21 +139,21 @@ _super.prototype._evalinst.call(this, n, i, r, ri, si); | ||
switch (rule[0]) { | ||
case 2 /* IMPROPER_FRACTION */: | ||
case 1 /* PROPER_FRACTION */: | ||
case 2 /* RuleType.IMPROPER_FRACTION */: | ||
case 1 /* RuleType.PROPER_FRACTION */: | ||
var sym = rule[2] === 1 ? ',' : '.'; | ||
res += "\"" + (rule[0] === 2 /* IMPROPER_FRACTION */ ? 'x' : '0') + sym + "x\""; | ||
res += "\"".concat(rule[0] === 2 /* RuleType.IMPROPER_FRACTION */ ? 'x' : '0').concat(sym, "x\""); | ||
break; | ||
case 0 /* MINUS */: | ||
case 0 /* RuleType.MINUS */: | ||
res += '"-x"'; | ||
break; | ||
case 5 /* INFINITY */: | ||
case 5 /* RuleType.INFINITY */: | ||
res += "\"Inf\""; | ||
break; | ||
case 6 /* NOT_A_NUMBER */: | ||
case 6 /* RuleType.NOT_A_NUMBER */: | ||
res += 'NaN'; | ||
break; | ||
case 3 /* NORMAL */: | ||
res += "\"" + rbnf.numbers[rule[2]] + "\""; | ||
case 3 /* RuleType.NORMAL */: | ||
res += "\"".concat(rbnf.numbers[rule[2]], "\""); | ||
break; | ||
case 4 /* NORMAL_RADIX */: | ||
res += "\"" + rbnf.numbers[rule[2]] + "/" + rbnf.numbers[rule[3]] + "\""; | ||
case 4 /* RuleType.NORMAL_RADIX */: | ||
res += "\"".concat(rbnf.numbers[rule[2]], "/").concat(rbnf.numbers[rule[3]], "\""); | ||
break; | ||
@@ -168,31 +168,31 @@ default: | ||
switch (i[0]) { | ||
case 13 /* APPLY_LEFT_NUM_FORMAT */: | ||
return "<" + rbnf.symbols[i[1]] + "<"; | ||
case 7 /* APPLY_LEFT_RULE */: | ||
return "<%" + rbnf.allnames[i[1]] + "%<"; | ||
case 14 /* APPLY_LEFT_2_NUM_FORMAT */: | ||
return "<" + rbnf.symbols[i[1]] + "<<"; | ||
case 11 /* APPLY_LEFT_2_RULE */: | ||
return "<%" + rbnf.allnames[i[1]] + "%<<"; | ||
case 3 /* APPLY_RIGHT_RULE */: | ||
return ">%" + rbnf.allnames[i[1]] + "%>"; | ||
case 2 /* OPTIONAL */: | ||
case 13 /* Opcode.APPLY_LEFT_NUM_FORMAT */: | ||
return "<".concat(rbnf.symbols[i[1]], "<"); | ||
case 7 /* Opcode.APPLY_LEFT_RULE */: | ||
return "<%".concat(rbnf.allnames[i[1]], "%<"); | ||
case 14 /* Opcode.APPLY_LEFT_2_NUM_FORMAT */: | ||
return "<".concat(rbnf.symbols[i[1]], "<<"); | ||
case 11 /* Opcode.APPLY_LEFT_2_RULE */: | ||
return "<%".concat(rbnf.allnames[i[1]], "%<<"); | ||
case 3 /* Opcode.APPLY_RIGHT_RULE */: | ||
return ">%".concat(rbnf.allnames[i[1]], "%>"); | ||
case 2 /* Opcode.OPTIONAL */: | ||
return '[' + i[1].map(function (_i) { return instrepr(rbnf, _i); }).join('') + ']'; | ||
case 0 /* LITERAL */: | ||
case 0 /* Opcode.LITERAL */: | ||
return rbnf.symbols[i[1]]; | ||
case 4 /* SUB_LEFT */: | ||
case 4 /* Opcode.SUB_LEFT */: | ||
return '<<'; | ||
case 1 /* SUB_RIGHT */: | ||
case 1 /* Opcode.SUB_RIGHT */: | ||
return '>>'; | ||
case 9 /* SUB_RIGHT_3 */: | ||
case 9 /* Opcode.SUB_RIGHT_3 */: | ||
return '>>>'; | ||
case 6 /* UNCHANGED_NUM_FORMAT */: | ||
return "=" + rbnf.symbols[i[1]] + "="; | ||
case 5 /* UNCHANGED_RULE */: | ||
return "=%" + rbnf.allnames[i[1]] + "%="; | ||
case 8 /* CARDINAL */: | ||
case 10 /* ORDINAL */: | ||
var r = i[0] === 8 /* CARDINAL */ ? 'cardinal' : 'ordinal'; | ||
var subs = i[1].map(function (s) { return REVPLURALS[s[0]] + "{" + rbnf.symbols[s[1]] + "}"; }).join(''); | ||
return "$(" + r + "," + subs + ")$"; | ||
case 6 /* Opcode.UNCHANGED_NUM_FORMAT */: | ||
return "=".concat(rbnf.symbols[i[1]], "="); | ||
case 5 /* Opcode.UNCHANGED_RULE */: | ||
return "=%".concat(rbnf.allnames[i[1]], "%="); | ||
case 8 /* Opcode.CARDINAL */: | ||
case 10 /* Opcode.ORDINAL */: | ||
var r = i[0] === 8 /* Opcode.CARDINAL */ ? 'cardinal' : 'ordinal'; | ||
var subs = i[1].map(function (s) { return "".concat(REVPLURALS[s[0]], "{").concat(rbnf.symbols[s[1]], "}"); }).join(''); | ||
return "$(".concat(r, ",").concat(subs, ")$"); | ||
default: | ||
@@ -203,27 +203,27 @@ return OPCODES[i[0]]; | ||
export var OPCODES = (_a = {}, | ||
_a[14 /* APPLY_LEFT_2_NUM_FORMAT */] = 'APPLY_LEFT_2_NUM_FORMAT', | ||
_a[11 /* APPLY_LEFT_2_RULE */] = 'APPLY_LEFT_2_RULE', | ||
_a[13 /* APPLY_LEFT_NUM_FORMAT */] = 'APPLY_LEFT_NUM_FORMAT', | ||
_a[7 /* APPLY_LEFT_RULE */] = 'APPLY_LEFT_RULE', | ||
_a[12 /* APPLY_RIGHT_NUM_FORMAT */] = 'APPLY_RIGHT_NUM_FORMAT', | ||
_a[3 /* APPLY_RIGHT_RULE */] = 'APPLY_RIGHT_RULE', | ||
_a[8 /* CARDINAL */] = 'CARDINAL', | ||
_a[0 /* LITERAL */] = 'LITERAL', | ||
_a[2 /* OPTIONAL */] = 'OPTIONAL', | ||
_a[10 /* ORDINAL */] = 'ORDINAL', | ||
_a[4 /* SUB_LEFT */] = 'SUB_LEFT', | ||
_a[1 /* SUB_RIGHT */] = 'SUB_RIGHT', | ||
_a[9 /* SUB_RIGHT_3 */] = 'SUB_RIGHT_3', | ||
_a[6 /* UNCHANGED_NUM_FORMAT */] = 'UNCHANGED_NUM_FORMAT', | ||
_a[5 /* UNCHANGED_RULE */] = 'UNCHANGED_RULE', | ||
_a[14 /* Opcode.APPLY_LEFT_2_NUM_FORMAT */] = 'APPLY_LEFT_2_NUM_FORMAT', | ||
_a[11 /* Opcode.APPLY_LEFT_2_RULE */] = 'APPLY_LEFT_2_RULE', | ||
_a[13 /* Opcode.APPLY_LEFT_NUM_FORMAT */] = 'APPLY_LEFT_NUM_FORMAT', | ||
_a[7 /* Opcode.APPLY_LEFT_RULE */] = 'APPLY_LEFT_RULE', | ||
_a[12 /* Opcode.APPLY_RIGHT_NUM_FORMAT */] = 'APPLY_RIGHT_NUM_FORMAT', | ||
_a[3 /* Opcode.APPLY_RIGHT_RULE */] = 'APPLY_RIGHT_RULE', | ||
_a[8 /* Opcode.CARDINAL */] = 'CARDINAL', | ||
_a[0 /* Opcode.LITERAL */] = 'LITERAL', | ||
_a[2 /* Opcode.OPTIONAL */] = 'OPTIONAL', | ||
_a[10 /* Opcode.ORDINAL */] = 'ORDINAL', | ||
_a[4 /* Opcode.SUB_LEFT */] = 'SUB_LEFT', | ||
_a[1 /* Opcode.SUB_RIGHT */] = 'SUB_RIGHT', | ||
_a[9 /* Opcode.SUB_RIGHT_3 */] = 'SUB_RIGHT_3', | ||
_a[6 /* Opcode.UNCHANGED_NUM_FORMAT */] = 'UNCHANGED_NUM_FORMAT', | ||
_a[5 /* Opcode.UNCHANGED_RULE */] = 'UNCHANGED_RULE', | ||
_a); | ||
export var RULETYPES = (_b = {}, | ||
_b[2 /* IMPROPER_FRACTION */] = 'IMPROPER_FRACTION', | ||
_b[5 /* INFINITY */] = 'INFINITY', | ||
_b[0 /* MINUS */] = 'MINUS', | ||
_b[3 /* NORMAL */] = 'NORMAL', | ||
_b[4 /* NORMAL_RADIX */] = 'NORMAL_RADIX', | ||
_b[6 /* NOT_A_NUMBER */] = 'NOT_A_NUMBER', | ||
_b[1 /* PROPER_FRACTION */] = 'PROPER_FRACTION', | ||
_b[2 /* RuleType.IMPROPER_FRACTION */] = 'IMPROPER_FRACTION', | ||
_b[5 /* RuleType.INFINITY */] = 'INFINITY', | ||
_b[0 /* RuleType.MINUS */] = 'MINUS', | ||
_b[3 /* RuleType.NORMAL */] = 'NORMAL', | ||
_b[4 /* RuleType.NORMAL_RADIX */] = 'NORMAL_RADIX', | ||
_b[6 /* RuleType.NOT_A_NUMBER */] = 'NOT_A_NUMBER', | ||
_b[1 /* RuleType.PROPER_FRACTION */] = 'PROPER_FRACTION', | ||
_b); | ||
//# sourceMappingURL=debug.js.map |
import { Decimal } from '@phensley/decimal'; | ||
import { PluralRules } from '@phensley/plurals'; | ||
import { ApplyLeft2NumFormatInst, ApplyLeft2RuleInst, ApplyLeftNumFormatInst, ApplyLeftRuleInst, RBNFInst, RBNFRule, SubLeftInst } from './rbnftypes'; | ||
declare type IntegerSubInst = ApplyLeftRuleInst | ApplyLeft2RuleInst | ApplyLeft2NumFormatInst | ApplyLeftNumFormatInst | SubLeftInst; | ||
type IntegerSubInst = ApplyLeftRuleInst | ApplyLeft2RuleInst | ApplyLeft2NumFormatInst | ApplyLeftNumFormatInst | SubLeftInst; | ||
export interface RBNFSymbols { | ||
@@ -10,3 +10,3 @@ decimal: string; | ||
} | ||
export declare type RBNFDecimalFormatter = (pattern: string, n: Decimal) => string; | ||
export type RBNFDecimalFormatter = (pattern: string, n: Decimal) => string; | ||
/** | ||
@@ -13,0 +13,0 @@ * A collection of multiple RBNF locale-specific rulesets with shared arrays of |
@@ -7,3 +7,3 @@ import { Decimal, DecimalConstants } from '@phensley/decimal'; | ||
// This table stops just past the largest base value found in the RBNF dataset. | ||
var DIVISORS = [0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18].map(function (e) { return new Decimal("1e" + e); }); | ||
var DIVISORS = [0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18].map(function (e) { return new Decimal("1e".concat(e)); }); | ||
var ONE = DecimalConstants.ONE, ZERO = DecimalConstants.ZERO; | ||
@@ -112,3 +112,3 @@ var MINUS_ONE = ONE.negate(); | ||
if (this.errors.length) { | ||
console.log("ERRORS: '" + this.language + "' rule '" + name + "' number '" + n.toString() + "' " + this.errors.join('\n')); | ||
console.log("ERRORS: '".concat(this.language, "' rule '").concat(name, "' number '").concat(n.toString(), "' ").concat(this.errors.join('\n'))); | ||
} | ||
@@ -140,3 +140,3 @@ return this.buf; | ||
switch (r[0]) { | ||
case 6 /* NOT_A_NUMBER */: | ||
case 6 /* RuleType.NOT_A_NUMBER */: | ||
if (n.isNaN()) { | ||
@@ -146,3 +146,3 @@ return { value: i }; | ||
break; | ||
case 5 /* INFINITY */: | ||
case 5 /* RuleType.INFINITY */: | ||
if (n.isInfinity()) { | ||
@@ -152,3 +152,3 @@ return { value: i }; | ||
break; | ||
case 0 /* MINUS */: | ||
case 0 /* RuleType.MINUS */: | ||
if (neg) { | ||
@@ -158,3 +158,3 @@ return { value: i }; | ||
break; | ||
case 1 /* PROPER_FRACTION */: | ||
case 1 /* RuleType.PROPER_FRACTION */: | ||
if (!int && | ||
@@ -167,3 +167,3 @@ fin && | ||
break; | ||
case 2 /* IMPROPER_FRACTION */: | ||
case 2 /* RuleType.IMPROPER_FRACTION */: | ||
// If present it always follows a proper fraction rule, catching anything that falls through | ||
@@ -174,4 +174,4 @@ if (!int && fin && r[2] === this_1.decimal) { | ||
break; | ||
case 3 /* NORMAL */: | ||
case 4 /* NORMAL_RADIX */: | ||
case 3 /* RuleType.NORMAL */: | ||
case 4 /* RuleType.NORMAL_RADIX */: | ||
if (fin) { | ||
@@ -182,3 +182,3 @@ var m_1 = n.abs(); | ||
var name_1 = this_1.rbnf.allnames[si]; | ||
this_1.errors.push("Malformed rules in ruleset '" + name_1 + "' at " + i + " for " + n.toString() + ": got " + j); | ||
this_1.errors.push("Malformed rules in ruleset '".concat(name_1, "' at ").concat(i, " for ").concat(n.toString(), ": got ").concat(j)); | ||
return { value: -1 }; | ||
@@ -203,6 +203,6 @@ } | ||
switch (inst[0]) { | ||
case 0 /* LITERAL */: | ||
case 0 /* Opcode.LITERAL */: | ||
this_2.symbol(inst[1]); | ||
break; | ||
case 2 /* OPTIONAL */: | ||
case 2 /* Opcode.OPTIONAL */: | ||
// If number is not a multiple of radix, execute the optional block | ||
@@ -213,6 +213,6 @@ if (ZERO.compare(n.divmod(this_2.getradix(r))[1]) !== 0) { | ||
break; | ||
case 8 /* CARDINAL */: | ||
case 10 /* ORDINAL */: | ||
case 8 /* Opcode.CARDINAL */: | ||
case 10 /* Opcode.ORDINAL */: | ||
var q = n.divmod(this_2.getradix(r))[0]; | ||
var cat_1 = this_2.plural(q.stripTrailingZeros(), inst[0] === 8 /* CARDINAL */); | ||
var cat_1 = this_2.plural(q.stripTrailingZeros(), inst[0] === 8 /* Opcode.CARDINAL */); | ||
// Select string matching plural category, and fall back to 'other' | ||
@@ -227,12 +227,12 @@ var subs = inst[1].filter(function (s) { return s[0] === cat_1; }); | ||
break; | ||
case 4 /* SUB_LEFT */: | ||
case 7 /* APPLY_LEFT_RULE */: | ||
case 11 /* APPLY_LEFT_2_RULE */: | ||
case 13 /* APPLY_LEFT_NUM_FORMAT */: | ||
case 14 /* APPLY_LEFT_2_NUM_FORMAT */: | ||
if (r[0] === 1 /* PROPER_FRACTION */ || r[0] === 2 /* IMPROPER_FRACTION */) { | ||
case 4 /* Opcode.SUB_LEFT */: | ||
case 7 /* Opcode.APPLY_LEFT_RULE */: | ||
case 11 /* Opcode.APPLY_LEFT_2_RULE */: | ||
case 13 /* Opcode.APPLY_LEFT_NUM_FORMAT */: | ||
case 14 /* Opcode.APPLY_LEFT_2_NUM_FORMAT */: | ||
if (r[0] === 1 /* RuleType.PROPER_FRACTION */ || r[0] === 2 /* RuleType.IMPROPER_FRACTION */) { | ||
this_2.integersub(n, inst, ri, si); | ||
} | ||
else if (this_2.fractions.has(si)) { | ||
var base = r[0] === 3 /* NORMAL */ || r[0] === 4 /* NORMAL_RADIX */ ? r[2] : -1; | ||
var base = r[0] === 3 /* RuleType.NORMAL */ || r[0] === 4 /* RuleType.NORMAL_RADIX */ ? r[2] : -1; | ||
if (base !== -1) { | ||
@@ -246,15 +246,15 @@ this_2.numeratorsub(n, inst, base, ri, si); | ||
break; | ||
case 5 /* UNCHANGED_RULE */: | ||
case 5 /* Opcode.UNCHANGED_RULE */: | ||
this_2._format(n, inst[1]); | ||
break; | ||
case 6 /* UNCHANGED_NUM_FORMAT */: | ||
case 6 /* Opcode.UNCHANGED_NUM_FORMAT */: | ||
this_2.buf += this_2.fallback(this_2.rbnf.symbols[inst[1]], n); | ||
break; | ||
case 1 /* SUB_RIGHT */: | ||
case 9 /* SUB_RIGHT_3 */: | ||
case 3 /* APPLY_RIGHT_RULE */: | ||
if (r[0] === 0 /* MINUS */) { | ||
this_2._format(n.abs(), inst[0] === 3 /* APPLY_RIGHT_RULE */ ? inst[1] : si); | ||
case 1 /* Opcode.SUB_RIGHT */: | ||
case 9 /* Opcode.SUB_RIGHT_3 */: | ||
case 3 /* Opcode.APPLY_RIGHT_RULE */: | ||
if (r[0] === 0 /* RuleType.MINUS */) { | ||
this_2._format(n.abs(), inst[0] === 3 /* Opcode.APPLY_RIGHT_RULE */ ? inst[1] : si); | ||
} | ||
else if (r[0] === 1 /* PROPER_FRACTION */ || r[0] === 2 /* IMPROPER_FRACTION */) { | ||
else if (r[0] === 1 /* RuleType.PROPER_FRACTION */ || r[0] === 2 /* RuleType.IMPROPER_FRACTION */) { | ||
var m = n.abs(); | ||
@@ -282,5 +282,5 @@ this_2.fractionsub(m.subtract(m.toInteger()), inst, ri, si); | ||
RBNFEngine.prototype.fractionsub = function (n, inst, ri, si) { | ||
var _si = inst[0] === 3 /* APPLY_RIGHT_RULE */ ? inst[1] : si; | ||
var digits = inst[0] === 1 /* SUB_RIGHT */ || inst[0] === 9 /* SUB_RIGHT_3 */ || _si === si; | ||
var spaces = inst[0] !== 9 /* SUB_RIGHT_3 */; | ||
var _si = inst[0] === 3 /* Opcode.APPLY_RIGHT_RULE */ ? inst[1] : si; | ||
var digits = inst[0] === 1 /* Opcode.SUB_RIGHT */ || inst[0] === 9 /* Opcode.SUB_RIGHT_3 */ || _si === si; | ||
var spaces = inst[0] !== 9 /* Opcode.SUB_RIGHT_3 */; | ||
if (digits) { | ||
@@ -311,9 +311,9 @@ this.bydigit(n, ri, si, spaces); | ||
switch (inst[0]) { | ||
case 7 /* APPLY_LEFT_RULE */: | ||
case 11 /* APPLY_LEFT_2_RULE */: | ||
case 4 /* SUB_LEFT */: | ||
this._format(n, inst[0] === 4 /* SUB_LEFT */ ? si : inst[1]); | ||
case 7 /* Opcode.APPLY_LEFT_RULE */: | ||
case 11 /* Opcode.APPLY_LEFT_2_RULE */: | ||
case 4 /* Opcode.SUB_LEFT */: | ||
this._format(n, inst[0] === 4 /* Opcode.SUB_LEFT */ ? si : inst[1]); | ||
break; | ||
case 13 /* APPLY_LEFT_NUM_FORMAT */: | ||
case 14 /* APPLY_LEFT_2_NUM_FORMAT */: | ||
case 13 /* Opcode.APPLY_LEFT_NUM_FORMAT */: | ||
case 14 /* Opcode.APPLY_LEFT_2_NUM_FORMAT */: | ||
// TODO: implement number format | ||
@@ -326,3 +326,3 @@ this.buf += '#'; | ||
switch (inst[0]) { | ||
case 11 /* APPLY_LEFT_2_RULE */: | ||
case 11 /* Opcode.APPLY_LEFT_2_RULE */: | ||
this._format(n, inst[1]); | ||
@@ -335,5 +335,5 @@ break; | ||
switch (inst[0]) { | ||
case 7 /* APPLY_LEFT_RULE */: | ||
case 4 /* SUB_LEFT */: | ||
this._format(q, inst[0] === 4 /* SUB_LEFT */ ? si : inst[1]); | ||
case 7 /* Opcode.APPLY_LEFT_RULE */: | ||
case 4 /* Opcode.SUB_LEFT */: | ||
this._format(q, inst[0] === 4 /* Opcode.SUB_LEFT */ ? si : inst[1]); | ||
break; | ||
@@ -349,5 +349,5 @@ default: | ||
switch (inst[0]) { | ||
case 3 /* APPLY_RIGHT_RULE */: | ||
case 1 /* SUB_RIGHT */: | ||
this._format(r, inst[0] === 1 /* SUB_RIGHT */ ? si : inst[1]); | ||
case 3 /* Opcode.APPLY_RIGHT_RULE */: | ||
case 1 /* Opcode.SUB_RIGHT */: | ||
this._format(r, inst[0] === 1 /* Opcode.SUB_RIGHT */ ? si : inst[1]); | ||
break; | ||
@@ -378,5 +378,5 @@ } | ||
var n = this.rbnf.numbers; | ||
return r[0] === 4 /* NORMAL_RADIX */ | ||
return r[0] === 4 /* RuleType.NORMAL_RADIX */ | ||
? n[r[3]] | ||
: r[0] === 3 /* NORMAL */ | ||
: r[0] === 3 /* RuleType.NORMAL */ | ||
? DIVISORS[n[r[2]].integerDigits()] | ||
@@ -383,0 +383,0 @@ : TEN; |
@@ -19,4 +19,4 @@ /** | ||
} | ||
export declare type AtomType = RuleType.MINUS | RuleType.INFINITY | RuleType.NOT_A_NUMBER; | ||
export declare type FractionType = RuleType.PROPER_FRACTION | RuleType.IMPROPER_FRACTION; | ||
export type AtomType = RuleType.MINUS | RuleType.INFINITY | RuleType.NOT_A_NUMBER; | ||
export type FractionType = RuleType.PROPER_FRACTION | RuleType.IMPROPER_FRACTION; | ||
/** | ||
@@ -54,3 +54,3 @@ * An atom rule has a type and one or more instructions to evaluate. | ||
} | ||
export declare type RBNFRule = AtomRule | FractionRule | NormalRule | NormalRadixRule; | ||
export type RBNFRule = AtomRule | FractionRule | NormalRule | NormalRadixRule; | ||
/** | ||
@@ -146,5 +146,5 @@ * Instruction opcodes, sorted from most- to least-frequent. | ||
} | ||
export declare type RBNFInst = LiteralInst | ApplyLeftRuleInst | ApplyLeftNumFormatInst | ApplyLeft2RuleInst | ApplyLeft2NumFormatInst | ApplyRightRuleInst | ApplyRightNumFormatInst | CardinalInst | OrdinalInst | OptionalInst | SubLeftInst | SubRightInst | SubRight3Inst | UnchangedRuleInst | UnchangedNumFormatInst; | ||
export type RBNFInst = LiteralInst | ApplyLeftRuleInst | ApplyLeftNumFormatInst | ApplyLeft2RuleInst | ApplyLeft2NumFormatInst | ApplyRightRuleInst | ApplyRightNumFormatInst | CardinalInst | OrdinalInst | OptionalInst | SubLeftInst | SubRightInst | SubRight3Inst | UnchangedRuleInst | UnchangedNumFormatInst; | ||
export declare const PLURALS: { | ||
[x: string]: number; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AlgorithmicNumberingSystem = exports.AlgorithmicNumberingSystems = void 0; | ||
var plurals_1 = require("@phensley/plurals"); | ||
@@ -4,0 +5,0 @@ var autogen_names_1 = require("./autogen.names"); |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.algorithmicNumbering = void 0; | ||
/* eslint-disable max-len */ | ||
@@ -8,0 +9,0 @@ exports.algorithmicNumbering = { |
@@ -6,4 +6,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.rbnfRulesets = void 0; | ||
// eslint-disable-next-line max-len | ||
exports.rbnfRulesets = { "locales": { "ja-Jpan": { "names": ["digits-ordinal_spellout-cardinal_spellout-cardinal-financial_spellout-numbering_spellout-numbering-year_spellout-numbering-year-latn_spellout-ordinal", "spellout-numbering-year-digits"], "rulesets": [[[0, [[0, 45], [12, 1]]], [3, [[0, 23], [6, 1]], 3]], [[0, [[0, 49], [1]]], [2, [[4], [0, 102], [9]], 0], [2, [[4], [0, 102], [9]], 1], [3, [[0, 5]], 3], [3, [[0, 7]], 0], [3, [[0, 27]], 7], [3, [[0, 20]], 9], [3, [[0, 13]], 10], [3, [[0, 21]], 11], [3, [[0, 14]], 12], [3, [[0, 15]], 13], [3, [[0, 16]], 14], [3, [[0, 17]], 15], [3, [[0, 18], [2, [[1]]]], 1], [3, [[4], [0, 18], [2, [[1]]]], 2], [3, [[0, 11], [2, [[1]]]], 4], [3, [[4], [0, 11], [2, [[1]]]], 20], [3, [[0, 12], [2, [[1]]]], 5], [3, [[4], [0, 12], [2, [[1]]]], 34], [3, [[4], [0, 28], [2, [[1]]]], 6], [3, [[4], [0, 24], [2, [[1]]]], 16], [3, [[4], [0, 8], [2, [[1]]]], 8], [3, [[4], [0, 9], [2, [[1]]]], 21], [3, [[6, 1]], 22]], [[0, [[0, 49], [1]]], [2, [[4], [0, 37], [9]], 0], [2, [[4], [0, 37], [9]], 1], [3, [[0, 0]], 3], [3, [[0, 103]], 0], [3, [[0, 104]], 7], [3, [[0, 105]], 9], [3, [[0, 13]], 10], [3, [[0, 46]], 11], [3, [[0, 14]], 12], [3, [[0, 15]], 13], [3, [[0, 16]], 14], [3, [[0, 17]], 15], [3, [[0, 25], [2, [[1]]]], 1], [3, [[4], [0, 25], [2, [[1]]]], 2], [3, [[4], [0, 11], [2, [[1]]]], 4], [3, [[4], [0, 12], [2, [[1]]]], 5], [3, [[4], [0, 29], [2, [[1]]]], 6], [3, [[4], [0, 24], [2, [[1]]]], 16], [3, [[4], [0, 8], [2, [[1]]]], 8], [3, [[4], [0, 9], [2, [[1]]]], 21], [3, [[6, 1]], 22]], [[3, [[5, 1]], 3]], [[2, [[6, 30]], 0], [2, [[6, 30]], 1], [3, [[5, 3]], 3], [3, [[0, 50]], 0], [3, [[5, 3]], 7], [3, [[5, 7]], 5], [3, [[5, 3]], 6]], [[2, [[6, 30]], 0], [2, [[6, 30]], 1], [3, [[6, 31]], 3], [3, [[0, 50]], 0], [3, [[6, 31]], 7]], [[2, [[6, 22]], 0], [2, [[6, 22]], 1], [3, [[0, 23], [5, 3]], 3]], [[3, [[5, 3]], 3], [3, [[4], [9]], 1], [3, [[4], [9]], 4], [3, [[4], [9]], 5]]] }, "root": { "names": ["armenian-lower_armenian-upper_cyrillic-lower_digits-ordinal_ethiopic_georgian_greek-lower_greek-upper_hebrew_hebrew-item_roman-lower_roman-upper_spellout-cardinal_spellout-numbering_spellout-numbering-year_spellout-ordinal_tamil", "cyrillic-lower-1-10_cyrillic-lower-final_cyrillic-lower-post_cyrillic-lower-thousands_ethiopic-p_ethiopic-p1_ethiopic-p2_ethiopic-p3_greek-numeral-majuscules_greek-numeral-minuscules_hebrew-0-99_hebrew-thousands_tamil-thousands"], "rulesets": [[[0, [[0, 3], [1]]], [2, [[6, 19]], 0], [2, [[6, 19]], 1], [3, [[0, 31]], 3], [3, [[0, 106]], 0], [3, [[0, 107]], 7], [3, [[0, 108]], 9], [3, [[0, 109]], 10], [3, [[0, 110]], 11], [3, [[0, 111]], 12], [3, [[0, 112]], 13], [3, [[0, 113]], 14], [3, [[0, 114]], 15], [3, [[0, 115], [2, [[1]]]], 1], [3, [[0, 116], [2, [[1]]]], 2], [3, [[0, 117], [2, [[1]]]], 17], [3, [[0, 118], [2, [[1]]]], 18], [3, [[0, 119], [2, [[1]]]], 19], [3, [[0, 120], [2, [[1]]]], 23], [3, [[0, 121], [2, [[1]]]], 24], [3, [[0, 122], [2, [[1]]]], 25], [3, [[0, 123], [2, [[1]]]], 26], [3, [[0, 124], [2, [[1]]]], 4], [3, [[0, 125], [2, [[1]]]], 20], [3, [[0, 126], [2, [[1]]]], 27], [3, [[0, 127], [2, [[1]]]], 28], [3, [[0, 128], [2, [[1]]]], 29], [3, [[0, 129], [2, [[1]]]], 30], [3, [[0, 130], [2, [[1]]]], 31], [3, [[0, 131], [2, [[1]]]], 32], [3, [[0, 132], [2, [[1]]]], 33], [3, [[0, 133], [2, [[1]]]], 5], [3, [[0, 134], [2, [[1]]]], 34], [3, [[0, 135], [2, [[1]]]], 35], [3, [[0, 136], [2, [[1]]]], 37], [3, [[0, 137], [2, [[1]]]], 38], [3, [[0, 138], [2, [[1]]]], 43], [3, [[0, 139], [2, [[1]]]], 44], [3, [[0, 140], [2, [[1]]]], 45], [3, [[0, 141], [2, [[1]]]], 46], [3, [[6, 1]], 6]], [[0, [[0, 3], [1]]], [2, [[6, 19]], 0], [2, [[6, 19]], 1], [3, [[0, 31]], 3], [3, [[0, 142]], 0], [3, [[0, 143]], 7], [3, [[0, 144]], 9], [3, [[0, 145]], 10], [3, [[0, 146]], 11], [3, [[0, 147]], 12], [3, [[0, 148]], 13], [3, [[0, 149]], 14], [3, [[0, 150]], 15], [3, [[0, 151], [2, [[1]]]], 1], [3, [[0, 152], [2, [[1]]]], 2], [3, [[0, 153], [2, [[1]]]], 17], [3, [[0, 154], [2, [[1]]]], 18], [3, [[0, 155], [2, [[1]]]], 19], [3, [[0, 156], [2, [[1]]]], 23], [3, [[0, 157], [2, [[1]]]], 24], [3, [[0, 158], [2, [[1]]]], 25], [3, [[0, 159], [2, [[1]]]], 26], [3, [[0, 160], [2, [[1]]]], 4], [3, [[0, 161], [2, [[1]]]], 20], [3, [[0, 162], [2, [[1]]]], 27], [3, [[0, 163], [2, [[1]]]], 28], [3, [[0, 164], [2, [[1]]]], 29], [3, [[0, 165], [2, [[1]]]], 30], [3, [[0, 166], [2, [[1]]]], 31], [3, [[0, 167], [2, [[1]]]], 32], [3, [[0, 168], [2, [[1]]]], 33], [3, [[0, 169], [2, [[1]]]], 5], [3, [[0, 170], [2, [[1]]]], 34], [3, [[0, 171], [2, [[1]]]], 35], [3, [[0, 172], [2, [[1]]]], 37], [3, [[0, 173], [2, [[1]]]], 38], [3, [[0, 174], [2, [[1]]]], 43], [3, [[0, 175], [2, [[1]]]], 44], [3, [[0, 176], [2, [[1]]]], 45], [3, [[0, 177], [2, [[1]]]], 46], [3, [[6, 1]], 6]], [[0, [[0, 3], [1]]], [2, [[4], [0, 32], [9]], 0], [2, [[4], [0, 32], [9]], 1], [3, [[0, 178]], 3], [3, [[5, 17], [0, 33]], 0], [3, [[0, 51]], 39], [3, [[0, 52]], 50], [3, [[0, 53]], 51], [3, [[0, 54]], 52], [3, [[0, 55]], 40], [3, [[0, 56]], 41], [3, [[0, 57]], 42], [3, [[0, 58]], 53], [3, [[0, 59]], 54], [3, [[0, 60], [3, 18]], 2], [3, [[0, 61], [3, 18]], 17], [3, [[0, 62], [3, 18]], 18], [3, [[0, 63], [3, 18]], 19], [3, [[0, 64], [3, 18]], 23], [3, [[0, 65], [3, 18]], 24], [3, [[0, 66], [3, 18]], 25], [3, [[0, 67], [3, 18]], 26], [3, [[0, 179], [3, 18]], 4], [3, [[0, 180], [3, 18]], 20], [3, [[0, 181], [3, 18]], 27], [3, [[0, 182], [3, 18]], 28], [3, [[0, 183], [3, 18]], 29], [3, [[0, 184], [3, 18]], 30], [3, [[0, 185], [3, 18]], 31], [3, [[0, 186]], 32], [3, [[0, 187], [1]], 62], [3, [[0, 188], [3, 18]], 33], [3, [[0, 68], [7, 17], [3, 19]], 5], [4, [[0, 68], [4], [2, [[0, 6], [1]]]], 6, 5], [4, [[7, 20], [2, [[0, 6], [1]]]], 77, 5], [3, [[0, 189], [4], [2, [[0, 6], [1]]]], 55], [3, [[0, 190], [4], [2, [[0, 6], [1]]]], 78], [3, [[0, 191], [4], [2, [[0, 6], [1]]]], 8], [3, [[0, 192], [4], [2, [[0, 6], [1]]]], 79], [3, [[6, 1]], 22]], [[0, [[0, 3], [1]]], [3, [[6, 1], [0, 32]], 3]], [[0, [[0, 3], [1]]], [2, [[4], [0, 247], [1]], 0], [2, [[4], [0, 247], [1]], 1], [3, [[0, 248]], 3], [3, [[0, 249]], 0], [3, [[0, 250]], 7], [3, [[0, 251]], 9], [3, [[0, 252]], 10], [3, [[0, 253]], 11], [3, [[0, 254]], 12], [3, [[0, 255]], 13], [3, [[0, 256]], 14], [3, [[0, 257]], 15], [3, [[0, 258], [2, [[1]]]], 1], [3, [[0, 259], [2, [[1]]]], 2], [3, [[0, 260], [2, [[1]]]], 17], [3, [[0, 261], [2, [[1]]]], 18], [3, [[0, 262], [2, [[1]]]], 19], [3, [[0, 263], [2, [[1]]]], 23], [3, [[0, 264], [2, [[1]]]], 24], [3, [[0, 265], [2, [[1]]]], 25], [3, [[0, 266], [2, [[1]]]], 26], [3, [[0, 69], [2, [[1]]]], 4], [3, [[4], [0, 69], [2, [[1]]]], 20], [3, [[0, 4], [2, [[1]]]], 6], [3, [[4], [0, 4], [2, [[1]]]], 61], [3, [[0, 4], [3, 22]], 16], [3, [[4], [0, 4], [3, 22]], 80], [3, [[0, 4], [3, 23]], 8], [3, [[4], [0, 4], [3, 23]], 81], [3, [[0, 4], [3, 24]], 21], [3, [[4], [0, 4], [3, 24]], 82], [3, [[6, 1]], 22]], [[0, [[0, 3], [1]]], [2, [[6, 19]], 0], [2, [[6, 19]], 1], [3, [[6, 1]], 3], [3, [[0, 267]], 0], [3, [[0, 268]], 7], [3, [[0, 269]], 9], [3, [[0, 270]], 10], [3, [[0, 271]], 11], [3, [[0, 272]], 12], [3, [[0, 273]], 13], [3, [[0, 274]], 14], [3, [[0, 275]], 15], [3, [[0, 276], [2, [[1]]]], 1], [3, [[0, 277], [2, [[1]]]], 2], [3, [[0, 278], [2, [[1]]]], 17], [3, [[0, 279], [2, [[1]]]], 18], [3, [[0, 280], [2, [[1]]]], 19], [3, [[0, 281], [2, [[1]]]], 23], [3, [[0, 282], [2, [[1]]]], 24], [3, [[0, 283], [2, [[1]]]], 25], [3, [[0, 284], [2, [[1]]]], 26], [3, [[0, 285], [2, [[1]]]], 4], [3, [[0, 286], [2, [[1]]]], 20], [3, [[0, 287], [2, [[1]]]], 27], [3, [[0, 288], [2, [[1]]]], 28], [3, [[0, 289], [2, [[1]]]], 29], [3, [[0, 290], [2, [[1]]]], 30], [3, [[0, 291], [2, [[1]]]], 31], [3, [[0, 292], [2, [[1]]]], 32], [3, [[0, 293], [2, [[1]]]], 33], [3, [[0, 294], [2, [[1]]]], 5], [3, [[0, 295], [2, [[1]]]], 34], [3, [[0, 296], [2, [[1]]]], 35], [3, [[0, 297], [2, [[1]]]], 37], [3, [[0, 298], [2, [[1]]]], 38], [3, [[0, 299], [2, [[1]]]], 43], [3, [[0, 300], [2, [[1]]]], 44], [3, [[0, 301], [2, [[1]]]], 45], [3, [[0, 302], [2, [[1]]]], 46], [3, [[0, 303], [2, [[1]]]], 6], [3, [[6, 1]], 61]], [[0, [[0, 3], [1]]], [2, [[4], [0, 32], [9]], 0], [2, [[4], [0, 32], [9]], 1], [3, [[5, 26], [0, 72]], 3]], [[0, [[0, 3], [1]]], [2, [[4], [0, 32], [9]], 0], [2, [[4], [0, 32], [9]], 1], [3, [[5, 25], [0, 72]], 3]], [[0, [[0, 3], [1]]], [2, [[6, 19]], 0], [2, [[6, 19]], 1], [3, [[5, 9], [0, 34]], 3], [3, [[0, 38], [3, 9]], 39], [3, [[0, 77]], 40], [3, [[0, 78]], 41], [3, [[0, 38], [3, 9]], 42], [3, [[0, 362]], 2], [3, [[0, 79], [3, 9]], 47], [3, [[0, 363]], 17], [3, [[0, 80], [3, 9]], 48], [3, [[0, 364]], 18], [3, [[0, 81], [3, 9]], 49], [3, [[0, 365]], 19], [3, [[0, 82], [3, 9]], 56], [3, [[0, 366]], 23], [3, [[0, 83], [3, 9]], 57], [3, [[0, 367]], 24], [3, [[0, 84], [3, 9]], 58], [3, [[0, 368]], 25], [3, [[0, 85], [3, 9]], 59], [3, [[0, 369]], 26], [3, [[0, 86], [3, 9]], 60], [3, [[0, 87], [3, 27]], 4], [3, [[0, 39], [3, 27]], 20], [3, [[0, 370]], 63], [3, [[0, 39], [3, 27]], 64], [3, [[0, 26], [3, 27]], 27], [3, [[0, 371]], 65], [3, [[0, 26], [3, 27]], 66], [3, [[0, 372]], 67], [3, [[0, 26], [3, 27]], 68], [3, [[0, 88], [3, 27]], 28], [3, [[0, 373]], 29], [3, [[0, 89], [3, 27]], 83], [3, [[0, 374]], 30], [3, [[0, 40], [3, 27]], 84], [3, [[0, 375]], 69], [3, [[0, 40], [3, 27]], 70], [3, [[0, 376]], 31], [3, [[0, 41], [3, 27]], 85], [3, [[0, 377]], 71], [3, [[0, 41], [3, 27]], 72], [3, [[0, 378]], 32], [3, [[0, 90], [3, 27]], 62], [3, [[0, 379]], 33], [3, [[0, 91], [3, 27]], 86], [3, [[0, 380]], 5], [3, [[7, 28], [2, [[1]]]], 73], [3, [[0, 381]], 34], [3, [[7, 28], [2, [[1]]]], 74], [3, [[4], [0, 382]], 35], [3, [[7, 28], [2, [[1]]]], 75], [3, [[0, 383]], 55], [3, [[6, 1]], 87]], [[0, [[0, 3], [1]]], [2, [[6, 19]], 0], [2, [[6, 19]], 1], [3, [[0, 92]], 3], [3, [[0, 392]], 0], [3, [[0, 393]], 7], [3, [[0, 394]], 9], [3, [[0, 395]], 10], [3, [[0, 396]], 11], [3, [[0, 397]], 12], [3, [[0, 398]], 13], [3, [[0, 399]], 14], [3, [[0, 400]], 15], [3, [[0, 93], [2, [[1]]]], 1], [3, [[0, 401]], 40], [3, [[0, 402]], 41], [3, [[0, 93], [1]], 42], [3, [[0, 403], [2, [[1]]]], 2], [3, [[0, 404], [2, [[1]]]], 17], [3, [[0, 405], [2, [[1]]]], 18], [3, [[0, 406], [2, [[1]]]], 19], [3, [[0, 407], [2, [[1]]]], 23], [3, [[0, 408], [2, [[1]]]], 24], [3, [[0, 409], [2, [[1]]]], 25], [3, [[0, 410], [2, [[1]]]], 26], [3, [[0, 87], [2, [[1]]]], 4], [3, [[0, 39], [2, [[1]]]], 20], [3, [[0, 411]], 63], [3, [[0, 39], [1]], 64], [3, [[0, 26], [2, [[1]]]], 27], [3, [[0, 412]], 65], [3, [[0, 26], [1]], 66], [3, [[0, 413]], 67], [3, [[0, 26], [1]], 68], [3, [[0, 88], [2, [[1]]]], 28], [3, [[0, 89], [2, [[1]]]], 29], [3, [[0, 40], [2, [[1]]]], 30], [3, [[0, 414]], 69], [3, [[0, 40], [1]], 70], [3, [[0, 41], [2, [[1]]]], 31], [3, [[0, 415]], 71], [3, [[0, 41], [1]], 72], [3, [[0, 90], [2, [[1]]]], 32], [3, [[0, 91], [2, [[1]]]], 33], [4, [[0, 416], [2, [[1]]]], 5, 4], [4, [[0, 417], [2, [[1]]]], 88, 4], [4, [[0, 418], [2, [[1]]]], 89, 4], [4, [[0, 419], [2, [[1]]]], 90, 4], [4, [[0, 420], [2, [[1]]]], 91, 4], [4, [[0, 421], [2, [[1]]]], 92, 4], [4, [[0, 422], [2, [[1]]]], 93, 4], [4, [[0, 423], [2, [[1]]]], 94, 4], [4, [[0, 424], [2, [[1]]]], 95, 4], [4, [[0, 425], [2, [[1]]]], 96, 4], [4, [[0, 426], [2, [[1]]]], 34, 4], [3, [[6, 1]], 97]], [[0, [[0, 3], [1]]], [2, [[6, 19]], 0], [2, [[6, 19]], 1], [3, [[0, 427]], 3], [3, [[0, 428]], 0], [3, [[0, 429]], 7], [3, [[0, 430]], 9], [3, [[0, 431]], 10], [3, [[0, 432]], 11], [3, [[0, 433]], 12], [3, [[0, 434]], 13], [3, [[0, 435]], 14], [3, [[0, 436]], 15], [3, [[0, 437], [2, [[1]]]], 1], [3, [[0, 438], [2, [[1]]]], 2], [3, [[0, 439], [2, [[1]]]], 17], [3, [[0, 440], [2, [[1]]]], 18], [3, [[0, 441], [2, [[1]]]], 19], [3, [[0, 442], [2, [[1]]]], 23], [3, [[0, 443], [2, [[1]]]], 24], [3, [[0, 444], [2, [[1]]]], 25], [3, [[0, 445], [2, [[1]]]], 26], [3, [[0, 446], [2, [[1]]]], 4], [3, [[0, 447], [2, [[1]]]], 20], [3, [[0, 448], [2, [[1]]]], 27], [3, [[0, 449], [2, [[1]]]], 28], [3, [[0, 450], [2, [[1]]]], 29], [3, [[0, 451], [2, [[1]]]], 30], [3, [[0, 452], [2, [[1]]]], 31], [3, [[0, 453], [2, [[1]]]], 32], [3, [[0, 454], [2, [[1]]]], 33], [3, [[0, 455], [2, [[1]]]], 5], [3, [[0, 456], [2, [[1]]]], 34], [3, [[0, 457], [2, [[1]]]], 35], [3, [[0, 458], [2, [[1]]]], 37], [3, [[6, 1]], 38]], [[0, [[0, 3], [1]]], [2, [[6, 19]], 0], [2, [[6, 19]], 1], [3, [[0, 459]], 3], [3, [[0, 460]], 0], [3, [[0, 461]], 7], [3, [[0, 462]], 9], [3, [[0, 463]], 10], [3, [[0, 464]], 11], [3, [[0, 465]], 12], [3, [[0, 466]], 13], [3, [[0, 467]], 14], [3, [[0, 468]], 15], [3, [[0, 469], [2, [[1]]]], 1], [3, [[0, 470], [2, [[1]]]], 2], [3, [[0, 471], [2, [[1]]]], 17], [3, [[0, 472], [2, [[1]]]], 18], [3, [[0, 473], [2, [[1]]]], 19], [3, [[0, 474], [2, [[1]]]], 23], [3, [[0, 475], [2, [[1]]]], 24], [3, [[0, 476], [2, [[1]]]], 25], [3, [[0, 477], [2, [[1]]]], 26], [3, [[0, 478], [2, [[1]]]], 4], [3, [[0, 479], [2, [[1]]]], 20], [3, [[0, 480], [2, [[1]]]], 27], [3, [[0, 481], [2, [[1]]]], 28], [3, [[0, 482], [2, [[1]]]], 29], [3, [[0, 483], [2, [[1]]]], 30], [3, [[0, 484], [2, [[1]]]], 31], [3, [[0, 485], [2, [[1]]]], 32], [3, [[0, 486], [2, [[1]]]], 33], [3, [[0, 487], [2, [[1]]]], 5], [3, [[0, 488], [2, [[1]]]], 34], [3, [[0, 489], [2, [[1]]]], 35], [3, [[0, 490], [2, [[1]]]], 37], [3, [[0, 491], [2, [[1]]]], 38], [3, [[0, 492], [2, [[1]]]], 43], [3, [[0, 493], [2, [[1]]]], 44], [3, [[0, 494], [2, [[1]]]], 45], [3, [[0, 495], [2, [[1]]]], 46], [3, [[0, 496], [2, [[1]]]], 6], [3, [[0, 497], [2, [[1]]]], 61], [3, [[0, 498], [2, [[1]]]], 99], [3, [[0, 499], [2, [[1]]]], 100], [3, [[0, 500], [2, [[1]]]], 101], [3, [[0, 501], [2, [[1]]]], 102], [3, [[0, 502], [2, [[1]]]], 103], [3, [[0, 503], [2, [[1]]]], 104], [3, [[0, 504], [2, [[1]]]], 105], [3, [[0, 505], [2, [[1]]]], 76], [3, [[0, 506], [2, [[1]]]], 106], [3, [[0, 507], [2, [[1]]]], 107], [3, [[6, 1]], 108]], [[0, [[0, 3], [1]]], [3, [[6, 22]], 3]], [[0, [[0, 3], [1]]], [3, [[6, 22]], 3]], [[0, [[0, 3], [1]]], [2, [[6, 30]], 0], [2, [[6, 30]], 1], [3, [[6, 31]], 3]], [[0, [[0, 3], [1]]], [3, [[6, 22], [0, 32]], 3]], [[0, [[0, 3], [1]]], [2, [[6, 19]], 0], [2, [[6, 19]], 1], [3, [[0, 508]], 3], [3, [[0, 509]], 0], [3, [[0, 510]], 7], [3, [[0, 511]], 9], [3, [[0, 512]], 10], [3, [[0, 513]], 11], [3, [[0, 514]], 12], [3, [[0, 515]], 13], [3, [[0, 516]], 14], [3, [[0, 517]], 15], [3, [[0, 94], [2, [[1]]]], 1], [3, [[4], [0, 94], [2, [[1]]]], 2], [3, [[0, 95], [2, [[1]]]], 4], [3, [[4], [0, 95], [2, [[1]]]], 20], [3, [[0, 47], [2, [[1]]]], 5], [3, [[4], [0, 47], [2, [[1]]]], 34], [4, [[4], [0, 518], [2, [[3, 29]]]], 55, 76], [3, [[6, 519]], 16]], [[3, [[0, 193]], 0], [3, [[0, 194]], 7], [3, [[0, 195]], 9], [3, [[0, 196]], 10], [3, [[0, 197]], 11], [3, [[0, 198]], 12], [3, [[0, 199]], 13], [3, [[0, 200]], 14], [3, [[0, 201]], 15], [3, [[0, 202]], 1]], [[3, [[0, 33]], 3], [3, [[0, 33], [5, 17]], 0], [3, [[0, 51]], 39], [3, [[0, 52]], 50], [3, [[0, 53]], 51], [3, [[0, 54]], 52], [3, [[0, 55]], 40], [3, [[0, 56]], 41], [3, [[0, 57]], 42], [3, [[0, 58]], 53], [3, [[0, 59]], 54], [3, [[0, 203]], 2], [3, [[0, 60], [1]], 47], [3, [[0, 204]], 17], [3, [[0, 61], [1]], 48], [3, [[0, 205]], 18], [3, [[0, 62], [1]], 49], [3, [[0, 206]], 19], [3, [[0, 63], [1]], 56], [3, [[0, 207]], 23], [3, [[0, 64], [1]], 57], [3, [[0, 208]], 24], [3, [[0, 65], [1]], 58], [3, [[0, 209]], 25], [3, [[0, 66], [1]], 59], [3, [[0, 210]], 26], [3, [[0, 67], [1]], 60]], [[3, [[0, 33]], 3], [3, [[5, 2]], 0]], [[3, [[0, 33]], 3], [3, [[0, 211]], 0], [3, [[0, 212]], 7], [3, [[0, 213]], 9], [3, [[0, 214]], 10], [3, [[0, 215]], 11], [3, [[0, 216]], 12], [3, [[0, 217]], 13], [3, [[0, 218]], 14], [3, [[0, 219]], 15], [3, [[0, 220]], 1], [3, [[0, 221]], 39], [3, [[0, 222]], 50], [3, [[0, 223]], 51], [3, [[0, 224]], 52], [3, [[0, 225]], 40], [3, [[0, 226]], 41], [3, [[0, 227]], 42], [3, [[0, 228]], 53], [3, [[0, 229]], 54], [3, [[0, 230], [1]], 2], [3, [[0, 231], [1]], 17], [3, [[0, 232], [1]], 18], [3, [[0, 233], [1]], 19], [3, [[0, 234], [1]], 23], [3, [[0, 235], [1]], 24], [3, [[0, 236], [1]], 25], [3, [[0, 237], [1]], 26], [3, [[0, 238], [1]], 4], [3, [[0, 239], [1]], 20], [3, [[0, 240], [1]], 27], [3, [[0, 241], [1]], 28], [3, [[0, 242], [1]], 29], [3, [[0, 243], [1]], 30], [3, [[0, 244], [1]], 31], [3, [[0, 245], [1]], 32], [3, [[0, 246], [1]], 33]], [[3, [[5, 4]], 0], [3, [[4], [0, 4], [2, [[1]]]], 6], [3, [[4], [0, 4], [3, 22]], 16], [3, [[4], [0, 4], [3, 23]], 8], [3, [[4], [0, 4], [3, 24]], 21]], [[3, [[0, 4]], 3], [3, [[0, 4], [5, 21]], 0], [3, [[7, 4], [0, 4], [2, [[3, 4]]]], 6]], [[3, [[0, 70]], 3], [3, [[0, 70], [5, 21]], 0], [3, [[7, 4], [0, 4], [3, 22]], 16]], [[3, [[0, 71]], 3], [3, [[0, 71], [5, 21]], 0], [3, [[7, 4], [0, 4], [3, 23]], 8]], [[3, [[0, 73]], 3], [3, [[0, 304]], 0], [3, [[0, 305]], 7], [3, [[0, 306]], 9], [3, [[0, 307]], 10], [3, [[0, 308]], 11], [3, [[0, 309]], 12], [3, [[0, 310]], 13], [3, [[0, 311]], 14], [3, [[0, 312]], 15], [3, [[0, 313], [2, [[1]]]], 1], [3, [[0, 314], [2, [[1]]]], 2], [3, [[0, 315], [2, [[1]]]], 17], [3, [[0, 74], [2, [[1]]]], 18], [3, [[0, 316], [2, [[1]]]], 19], [3, [[0, 317], [2, [[1]]]], 23], [3, [[0, 318], [2, [[1]]]], 24], [3, [[0, 319], [2, [[1]]]], 25], [3, [[0, 320], [2, [[1]]]], 26], [3, [[0, 321], [2, [[1]]]], 4], [3, [[0, 322], [2, [[1]]]], 20], [3, [[0, 323], [2, [[1]]]], 27], [3, [[0, 324], [2, [[1]]]], 28], [3, [[0, 325], [2, [[1]]]], 29], [3, [[0, 326], [2, [[1]]]], 30], [3, [[0, 327], [2, [[1]]]], 31], [3, [[0, 328], [2, [[1]]]], 32], [3, [[0, 329], [2, [[1]]]], 33], [3, [[0, 75], [4], [2, [[1]]]], 5], [3, [[4], [0, 74], [2, [[0, 6], [1]]]], 6], [3, [[4], [0, 330], [2, [[0, 6], [1]]]], 16], [3, [[4], [0, 331], [2, [[0, 6], [1]]]], 8], [3, [[4], [0, 332], [2, [[0, 6], [1]]]], 21], [3, [[6, 1]], 22]], [[3, [[0, 73]], 3], [3, [[0, 333]], 0], [3, [[0, 334]], 7], [3, [[0, 335]], 9], [3, [[0, 336]], 10], [3, [[0, 337]], 11], [3, [[0, 338]], 12], [3, [[0, 339]], 13], [3, [[0, 340]], 14], [3, [[0, 341]], 15], [3, [[0, 342], [2, [[1]]]], 1], [3, [[0, 343], [2, [[1]]]], 2], [3, [[0, 344], [2, [[1]]]], 17], [3, [[0, 76], [2, [[1]]]], 18], [3, [[0, 345], [2, [[1]]]], 19], [3, [[0, 346], [2, [[1]]]], 23], [3, [[0, 347], [2, [[1]]]], 24], [3, [[0, 348], [2, [[1]]]], 25], [3, [[0, 349], [2, [[1]]]], 26], [3, [[0, 350], [2, [[1]]]], 4], [3, [[0, 351], [2, [[1]]]], 20], [3, [[0, 352], [2, [[1]]]], 27], [3, [[0, 353], [2, [[1]]]], 28], [3, [[0, 354], [2, [[1]]]], 29], [3, [[0, 355], [2, [[1]]]], 30], [3, [[0, 356], [2, [[1]]]], 31], [3, [[0, 357], [2, [[1]]]], 32], [3, [[0, 358], [2, [[1]]]], 33], [3, [[0, 75], [4], [2, [[1]]]], 5], [3, [[4], [0, 76], [2, [[0, 6], [1]]]], 6], [3, [[4], [0, 359], [2, [[0, 6], [1]]]], 16], [3, [[4], [0, 360], [2, [[0, 6], [1]]]], 8], [3, [[4], [0, 361], [2, [[0, 6], [1]]]], 21], [3, [[6, 1]], 22]], [[3, [[0, 34]], 3], [3, [[0, 92], [5, 9]], 0], [3, [[0, 38], [3, 9]], 39], [3, [[0, 77]], 40], [3, [[0, 78]], 41], [3, [[0, 38], [3, 9]], 42], [3, [[0, 384]], 2], [3, [[0, 79], [3, 9]], 47], [3, [[0, 385]], 17], [3, [[0, 80], [3, 9]], 48], [3, [[0, 386]], 18], [3, [[0, 81], [3, 9]], 49], [3, [[0, 387]], 19], [3, [[0, 82], [3, 9]], 56], [3, [[0, 388]], 23], [3, [[0, 83], [3, 9]], 57], [3, [[0, 389]], 24], [3, [[0, 84], [3, 9]], 58], [3, [[0, 390]], 25], [3, [[0, 85], [3, 9]], 59], [3, [[0, 391]], 26], [3, [[0, 86], [3, 9]], 60]], [[3, [[5, 8]], 3], [3, [[5, 8], [2, [[0, 34]]]], 1], [3, [[5, 8], [2, [[0, 34]]]], 4], [3, [[5, 8], [0, 34]], 98]], [[3, [[5, 16]], 3], [3, [[4], [0, 47], [2, [[1]]]], 5]]] }, "zh-Hans": { "names": ["digits-ordinal_spellout-cardinal_spellout-cardinal-alternate2_spellout-cardinal-financial_spellout-numbering_spellout-numbering-days_spellout-numbering-year_spellout-ordinal", "cardinal-alternate2-13_cardinal-alternate2-2_cardinal-alternate2-3_cardinal-alternate2-4_cardinal-alternate2-5_cardinal-alternate2-8_cardinal13_cardinal2_cardinal3_cardinal4_cardinal5_cardinal8_financialnumber13_financialnumber2_financialnumber3_financialnumber4_financialnumber5_financialnumber8_number13_number2_number3_number4_number5_number8_numbering-days_spellout-numbering-year-digits"], "rulesets": [[[0, [[0, 45], [12, 1]]], [3, [[0, 23], [6, 1]], 3]], [[0, [[0, 36], [1]]], [2, [[4], [0, 37], [9]], 0], [2, [[4], [0, 37], [9]], 1], [3, [[0, 0]], 3], [3, [[0, 7]], 0], [3, [[0, 27]], 7], [3, [[0, 20]], 9], [3, [[0, 13]], 10], [3, [[0, 21]], 11], [3, [[0, 14]], 12], [3, [[0, 15]], 13], [3, [[0, 16]], 14], [3, [[0, 17]], 15], [3, [[5, 4]], 1], [3, [[4], [0, 11], [2, [[3, 15]]]], 4], [3, [[4], [0, 12], [2, [[3, 16]]]], 5], [3, [[4], [0, 28], [2, [[3, 17]]]], 6], [3, [[4], [0, 43], [2, [[3, 18]]]], 16], [3, [[4], [0, 8], [2, [[3, 19]]]], 8], [3, [[4], [0, 9], [2, [[3, 14]]]], 21], [3, [[6, 1]], 22]], [[0, [[0, 36], [1]]], [2, [[5, 1]], 0], [2, [[5, 1]], 1], [3, [[0, 0]], 3], [3, [[0, 7]], 0], [3, [[0, 523]], 7], [3, [[0, 20]], 9], [3, [[0, 13]], 10], [3, [[0, 21]], 11], [3, [[0, 14]], 12], [3, [[0, 15]], 13], [3, [[0, 16]], 14], [3, [[0, 17]], 15], [3, [[5, 4]], 1], [3, [[4], [0, 11], [2, [[3, 9]]]], 4], [3, [[4], [0, 12], [2, [[3, 10]]]], 5], [3, [[4], [0, 28], [2, [[3, 11]]]], 6], [3, [[4], [0, 43], [2, [[3, 12]]]], 16], [3, [[4], [0, 8], [2, [[3, 13]]]], 8], [3, [[4], [0, 9], [2, [[3, 8]]]], 21], [3, [[6, 1]], 22]], [[0, [[0, 36], [1]]], [2, [[4], [0, 37], [9]], 0], [2, [[4], [0, 37], [9]], 1], [3, [[0, 0]], 3], [3, [[0, 42]], 0], [3, [[0, 524]], 7], [3, [[0, 525]], 9], [3, [[0, 96]], 10], [3, [[0, 46]], 11], [3, [[0, 526]], 12], [3, [[0, 97]], 13], [3, [[0, 98]], 14], [3, [[0, 99]], 15], [3, [[0, 25], [2, [[1]]]], 1], [3, [[4], [0, 25], [2, [[1]]]], 2], [3, [[4], [0, 100], [2, [[3, 21]]]], 4], [3, [[4], [0, 101], [2, [[3, 22]]]], 5], [3, [[4], [0, 28], [2, [[3, 23]]]], 6], [3, [[4], [0, 43], [2, [[3, 24]]]], 16], [3, [[4], [0, 8], [2, [[3, 25]]]], 8], [3, [[4], [0, 9], [2, [[3, 20]]]], 21], [3, [[6, 1]], 22]], [[0, [[0, 36], [1]]], [2, [[4], [0, 37], [9]], 0], [2, [[4], [0, 37], [9]], 1], [3, [[0, 5]], 3], [3, [[0, 7]], 0], [3, [[0, 27]], 7], [3, [[0, 20]], 9], [3, [[0, 13]], 10], [3, [[0, 21]], 11], [3, [[0, 14]], 12], [3, [[0, 15]], 13], [3, [[0, 16]], 14], [3, [[0, 17]], 15], [3, [[0, 18], [2, [[1]]]], 1], [3, [[4], [0, 18], [2, [[1]]]], 2], [3, [[4], [0, 11], [2, [[3, 27]]]], 4], [3, [[4], [0, 12], [2, [[3, 28]]]], 5], [3, [[4], [0, 28], [2, [[3, 29]]]], 6], [3, [[4], [0, 43], [2, [[3, 30]]]], 16], [3, [[4], [0, 8], [2, [[3, 31]]]], 8], [3, [[4], [0, 9], [2, [[3, 26]]]], 21], [3, [[6, 1]], 22]], [[0, [[0, 36], [1]]], [2, [[6, 22]], 0], [2, [[6, 22]], 1], [3, [[0, 5]], 3], [3, [[0, 527], [5, 4]], 0], [3, [[5, 4]], 39], [3, [[5, 32]], 47]], [[2, [[6, 30]], 0], [2, [[6, 30]], 1], [3, [[5, 4]], 3], [3, [[5, 33]], 5], [3, [[5, 4]], 6]], [[2, [[6, 22]], 0], [2, [[6, 22]], 1], [3, [[0, 23], [5, 4]], 3]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 2]], 1], [3, [[0, 0], [5, 2]], 2], [3, [[5, 2]], 8]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 7], [5, 4]], 1], [3, [[5, 4]], 2]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 2]], 1], [3, [[0, 0], [5, 2]], 2], [3, [[5, 2]], 4]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 2]], 1], [3, [[0, 0], [5, 2]], 2], [3, [[5, 2]], 5]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 2]], 1], [3, [[0, 0], [5, 2]], 2], [3, [[5, 2]], 6]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 2]], 1], [3, [[0, 0], [5, 2]], 2], [3, [[5, 2]], 36]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 1]], 1], [3, [[0, 0], [5, 1]], 2], [3, [[5, 1]], 8]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 7], [5, 4]], 1], [3, [[5, 4]], 2]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 1]], 1], [3, [[0, 0], [5, 1]], 2], [3, [[5, 1]], 4]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 1]], 1], [3, [[0, 0], [5, 1]], 2], [3, [[5, 1]], 5]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 1]], 1], [3, [[0, 0], [5, 1]], 2], [3, [[5, 1]], 6]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 1]], 1], [3, [[0, 0], [5, 1]], 2], [3, [[5, 1]], 36]], [[3, [[0, 0], [5, 3]], 0], [3, [[0, 10], [5, 3]], 1], [3, [[0, 0], [5, 3]], 2], [3, [[5, 3]], 8]], [[3, [[0, 0], [5, 3]], 0], [3, [[0, 42], [5, 3]], 1], [3, [[5, 3]], 2]], [[3, [[0, 0], [5, 3]], 0], [3, [[0, 10], [5, 3]], 1], [3, [[0, 0], [5, 3]], 2], [3, [[5, 3]], 4]], [[3, [[0, 0], [5, 3]], 0], [3, [[0, 10], [5, 3]], 1], [3, [[0, 0], [5, 3]], 2], [3, [[5, 3]], 5]], [[3, [[0, 0], [5, 3]], 0], [3, [[0, 10], [5, 3]], 1], [3, [[0, 0], [5, 3]], 2], [3, [[5, 3]], 6]], [[3, [[0, 0], [5, 3]], 0], [3, [[0, 10], [5, 3]], 1], [3, [[0, 0], [5, 3]], 2], [3, [[5, 3]], 36]], [[3, [[0, 5], [5, 4]], 0], [3, [[0, 35], [5, 4]], 1], [3, [[0, 5], [5, 4]], 2], [3, [[5, 4]], 8]], [[3, [[0, 5], [5, 4]], 0], [3, [[0, 7], [5, 4]], 1], [3, [[5, 4]], 2]], [[3, [[0, 5], [5, 4]], 0], [3, [[0, 35], [5, 4]], 1], [3, [[0, 5], [5, 4]], 2], [3, [[5, 4]], 4]], [[3, [[0, 5], [5, 4]], 0], [3, [[0, 35], [5, 4]], 1], [3, [[0, 5], [5, 4]], 2], [3, [[5, 4]], 5]], [[3, [[0, 5], [5, 4]], 0], [3, [[0, 35], [5, 4]], 1], [3, [[0, 5], [5, 4]], 2], [3, [[5, 4]], 6]], [[3, [[0, 5], [5, 4]], 0], [3, [[0, 35], [5, 4]], 1], [3, [[0, 5], [5, 4]], 2], [3, [[5, 4]], 36]], [[3, [[5, 4]], 3], [3, [[0, 520], [1]], 47], [3, [[4], [0, 18]], 17], [3, [[0, 521], [1]], 48], [3, [[4], [0, 18]], 18], [3, [[0, 522], [1]], 49], [3, [[5, 4]], 19]], [[3, [[5, 4]], 3], [3, [[4], [9]], 1], [3, [[4], [9]], 4], [3, [[4], [9]], 5]]] }, "zh-Hant": { "names": ["digits-ordinal_spellout-cardinal_spellout-cardinal-alternate2_spellout-cardinal-financial_spellout-numbering_spellout-numbering-year_spellout-ordinal", "cardinal-alternate2-13_cardinal-alternate2-2_cardinal-alternate2-3_cardinal-alternate2-4_cardinal-alternate2-5_cardinal-alternate2-8_cardinal13_cardinal2_cardinal3_cardinal4_cardinal5_cardinal8_financialnumber13_financialnumber2_financialnumber3_financialnumber4_financialnumber5_financialnumber8_spellout-numbering-year-digits"], "rulesets": [[[0, [[0, 45], [12, 1]]], [3, [[0, 23], [6, 1]], 3]], [[0, [[0, 44], [1]]], [2, [[4], [0, 48], [9]], 0], [2, [[4], [0, 48], [9]], 1], [3, [[0, 0]], 3], [3, [[0, 7]], 0], [3, [[0, 27]], 7], [3, [[0, 20]], 9], [3, [[0, 13]], 10], [3, [[0, 21]], 11], [3, [[0, 14]], 12], [3, [[0, 15]], 13], [3, [[0, 16]], 14], [3, [[0, 17]], 15], [3, [[5, 4]], 1], [3, [[4], [0, 11], [2, [[3, 14]]]], 4], [3, [[4], [0, 12], [2, [[3, 15]]]], 5], [3, [[4], [0, 29], [2, [[3, 16]]]], 6], [3, [[4], [0, 24], [2, [[3, 17]]]], 16], [3, [[4], [0, 8], [2, [[3, 18]]]], 8], [3, [[4], [0, 9], [2, [[3, 13]]]], 21], [3, [[6, 1]], 22]], [[0, [[0, 44], [1]]], [2, [[5, 1]], 0], [2, [[5, 1]], 1], [3, [[0, 0]], 3], [3, [[0, 7]], 0], [3, [[0, 528]], 7], [3, [[0, 20]], 9], [3, [[0, 13]], 10], [3, [[0, 21]], 11], [3, [[0, 14]], 12], [3, [[0, 15]], 13], [3, [[0, 16]], 14], [3, [[0, 17]], 15], [3, [[5, 4]], 1], [3, [[4], [0, 11], [2, [[3, 8]]]], 4], [3, [[4], [0, 12], [2, [[3, 9]]]], 5], [3, [[4], [0, 29], [2, [[3, 10]]]], 6], [3, [[4], [0, 24], [2, [[3, 11]]]], 16], [3, [[4], [0, 8], [2, [[3, 12]]]], 8], [3, [[4], [0, 9], [2, [[3, 7]]]], 21], [3, [[6, 1]], 22]], [[0, [[0, 44], [1]]], [2, [[4], [0, 48], [9]], 0], [2, [[4], [0, 48], [9]], 1], [3, [[0, 0]], 3], [3, [[0, 42]], 0], [3, [[0, 529]], 7], [3, [[0, 530]], 9], [3, [[0, 96]], 10], [3, [[0, 46]], 11], [3, [[0, 531]], 12], [3, [[0, 97]], 13], [3, [[0, 98]], 14], [3, [[0, 99]], 15], [3, [[0, 25], [2, [[1]]]], 1], [3, [[4], [0, 25], [2, [[1]]]], 2], [3, [[4], [0, 100], [2, [[3, 20]]]], 4], [3, [[4], [0, 101], [2, [[3, 21]]]], 5], [3, [[4], [0, 29], [2, [[3, 22]]]], 6], [3, [[4], [0, 24], [2, [[3, 23]]]], 16], [3, [[4], [0, 8], [2, [[3, 24]]]], 8], [3, [[4], [0, 9], [2, [[3, 19]]]], 21], [3, [[6, 1]], 22]], [[0, [[0, 44], [1]]], [2, [[7, 1], [0, 48], [9]], 0], [2, [[7, 1], [0, 48], [9]], 1], [3, [[0, 5]], 3], [3, [[0, 7]], 0], [3, [[0, 27]], 7], [3, [[0, 20]], 9], [3, [[0, 13]], 10], [3, [[0, 21]], 11], [3, [[0, 14]], 12], [3, [[0, 15]], 13], [3, [[0, 16]], 14], [3, [[0, 17]], 15], [3, [[0, 18], [2, [[1]]]], 1], [3, [[4], [0, 18], [2, [[1]]]], 2], [3, [[7, 1], [0, 11], [2, [[3, 14]]]], 4], [3, [[7, 1], [0, 12], [2, [[3, 15]]]], 5], [3, [[7, 1], [0, 29], [2, [[3, 16]]]], 6], [3, [[7, 1], [0, 24], [2, [[3, 17]]]], 16], [3, [[7, 1], [0, 8], [2, [[3, 18]]]], 8], [3, [[7, 1], [0, 9], [2, [[3, 13]]]], 21], [3, [[6, 1]], 22]], [[2, [[6, 30]], 0], [2, [[6, 30]], 1], [3, [[5, 4]], 3], [3, [[5, 4]], 5], [3, [[5, 25]], 73], [3, [[5, 4]], 34], [3, [[5, 25]], 74], [3, [[5, 4]], 35], [3, [[5, 25]], 75], [3, [[5, 4]], 37], [3, [[5, 25]], 109], [3, [[5, 4]], 38], [3, [[5, 25]], 110], [3, [[5, 4]], 43], [3, [[5, 25]], 111], [3, [[5, 4]], 44], [3, [[5, 25]], 112], [3, [[5, 4]], 45], [3, [[5, 25]], 113], [3, [[5, 4]], 46], [3, [[5, 25]], 114], [3, [[5, 4]], 6]], [[2, [[6, 22]], 0], [2, [[6, 22]], 1], [3, [[0, 23], [5, 4]], 3]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 2]], 1], [3, [[0, 0], [5, 2]], 2], [3, [[5, 2]], 8]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 7], [5, 4]], 1], [3, [[5, 4]], 2]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 2]], 1], [3, [[0, 0], [5, 2]], 2], [3, [[5, 2]], 4]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 2]], 1], [3, [[0, 0], [5, 2]], 2], [3, [[5, 2]], 5]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 2]], 1], [3, [[0, 0], [5, 2]], 2], [3, [[5, 2]], 6]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 2]], 1], [3, [[0, 0], [5, 2]], 2], [3, [[5, 2]], 36]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 1]], 1], [3, [[0, 0], [5, 1]], 2], [3, [[5, 1]], 8]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 7], [5, 4]], 1], [3, [[5, 4]], 2]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 1]], 1], [3, [[0, 0], [5, 1]], 2], [3, [[5, 1]], 4]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 1]], 1], [3, [[0, 0], [5, 1]], 2], [3, [[5, 1]], 5]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 1]], 1], [3, [[0, 0], [5, 1]], 2], [3, [[5, 1]], 6]], [[3, [[0, 0], [5, 4]], 0], [3, [[0, 2], [5, 1]], 1], [3, [[0, 0], [5, 1]], 2], [3, [[5, 1]], 36]], [[3, [[0, 0], [5, 3]], 0], [3, [[0, 10], [5, 3]], 1], [3, [[0, 0], [5, 3]], 2], [3, [[5, 3]], 8]], [[3, [[0, 0], [5, 3]], 0], [3, [[0, 42], [5, 3]], 1], [3, [[5, 3]], 2]], [[3, [[0, 0], [5, 3]], 0], [3, [[0, 10], [5, 3]], 1], [3, [[0, 0], [5, 3]], 2], [3, [[5, 3]], 4]], [[3, [[0, 0], [5, 3]], 0], [3, [[0, 10], [5, 3]], 1], [3, [[0, 0], [5, 3]], 2], [3, [[5, 3]], 5]], [[3, [[0, 0], [5, 3]], 0], [3, [[0, 10], [5, 3]], 1], [3, [[0, 0], [5, 3]], 2], [3, [[5, 3]], 6]], [[3, [[0, 0], [5, 3]], 0], [3, [[0, 10], [5, 3]], 1], [3, [[0, 0], [5, 3]], 2], [3, [[5, 3]], 36]], [[3, [[5, 4]], 3], [3, [[4], [9]], 1], [3, [[4], [9]], 4], [3, [[4], [9]], 5]]] } }, "symbols": "零_#,##0_零一_−_፼_〇_ _一_兆_京_零壹_百_千_四_六_七_八_九_十_#,##0.00_三_五_#,##0.#_第_億_拾_ש_二_万_萬_0.0_0_._҃_׳_〇一_负_点_י״_ר_תר_תש_壹_亿_負_第−_伍_௲_點_マイナス_元_а҃і_в҃і_г҃і_д҃і_є҃і_ѕ҃і_з҃і_и҃і_ѳ҃і_к_л_м_н_ѯ_ѻ_п_ч_҂_፻_፼፼_፼፼፼_´_𐆊_Μ_͵_μ_ט״ו_ט״ז_כ״_ל״_מ״_נ״_ס״_ע״_פ״_צ״_ק_ת_תק_תת_תתק_״_י_௰_௱_肆_柒_捌_玖_佰_仟_・_壱_弐_参_ա_բ_գ_դ_ե_զ_է_ը_թ_ժ_ի_լ_խ_ծ_կ_հ_ձ_ղ_ճ_մ_յ_ն_շ_ո_չ_պ_ջ_ռ_ս_վ_տ_ր_ց_ւ_փ_ք_Ա_Բ_Գ_Դ_Ե_Զ_Է_Ը_Թ_Ժ_Ի_Լ_Խ_Ծ_Կ_Հ_Ձ_Ղ_Ճ_Մ_Յ_Ն_Շ_Ո_Չ_Պ_Ջ_Ռ_Ս_Վ_Տ_Ր_Ց_Ւ_Փ_Ք_0҃_р_с_т_у_ф_х_ѱ_ѿ҃_ѿ_ц_҂҂_҂҂҂_҂҂҂҂_҂҂҂҂҂_а_в_г_д_є_ѕ_з_и_ѳ_і_҃к_҃л_҃м_҃н_҃ѯ_҃ѻ_҃п_҃ч_҃҂а_҃҂в_҃҂г_҃҂д_҃҂є_҃҂ѕ_҃҂з_҃҂и_҃҂ѳ_҃҂і_҂а҃҂і_҂в҃҂і_҂г҃҂і_҂д҃҂і_҂є҃҂і_҂ѕ҃҂і_҂з҃҂і_҂и҃҂і_҂ѳ҃҂і_҂к_҂л_҂м_҂н_҂ѯ_҂ѻ_҂п_҂ч_҂р_҂с_҂т_҂у_҂ф_҂х_҂ѱ_҂ѿ_҂ц_፡_ባዶ_፩_፪_፫_፬_፭_፮_፯_፰_፱_፲_፳_፴_፵_፶_፷_፸_፹_፺_ა_ბ_გ_დ_ე_ვ_ზ_ჱ_თ_ი_კ_ლ_მ_ნ_ჲ_ო_პ_ჟ_რ_ს_ტ_უ_ჳ_ფ_ქ_ღ_ყ_შ_ჩ_ც_ძ_წ_ჭ_ხ_ჴ_ჵ_ჯ_Α_Β_Γ_Δ_Ε_Ϝ_Ζ_Η_Θ_Ι_Κ_Λ_Ν_Ξ_Ο_Π_Ϟ_Ρ_Σ_Τ_Υ_Φ_Χ_Ψ_Ω_Ϡ_ΜΜ_ΜΜΜ_ΜΜΜΜ_α_β_γ_δ_ε_ϝ_ζ_η_θ_ι_κ_λ_ν_ξ_ο_π_ϟ_ρ_σ_τ_υ_φ_χ_ψ_ω_ϡ_μμ_μμμ_μμμμ_כ׳_ל׳_מ׳_נ׳_ס׳_ע׳_פ׳_צ׳_רח״צ_ד״ש_שד״מ_ת״ק_ת״ר_תרח״צ_ת״ש_תשד״מ_ת״ת_תת״ק_אלף_אלפיים_ אלפים_אלף אלפים_״כ_״ל_״מ_״נ_״ס_״ע_״פ_״צ_א_ב_ג_ד_ה_ו_ז_ח_ט_טו_טז_כ_ל_מ_נ_ס_ע_פ_צ_רחצ_דש_שדמ_תרחצ_תשדמ_תתר_תתש_תתת_תתתק_תתתר_תתתש_תתתת_תתתתק_תתתתר_תתתתש_תתתתת_n_i_ii_iii_iv_v_vi_vii_viii_ix_x_xx_xxx_xl_l_lx_lxx_lxxx_xc_c_cc_ccc_cd_d_dc_dcc_dccc_cm_m_mm_mmm_mmmm_N_I_II_III_IV_V_VI_VII_VIII_IX_X_XX_XXX_XL_L_LX_LXX_LXXX_XC_C_CC_CCC_CD_D_DC_DCC_DCCC_CM_M_MM_MMM_Mↁ_ↁ_ↁM_ↁMM_ↁMMM_Mↂ_ↂ_ↂↂ_ↂↂↂ_ↂↇ_ↇ_ↇↂ_ↇↂↂ_ↇↂↂↂ_ↂↈ_ↈ_ↈↈ_ↈↈↈ_௦_௧_௨_௩_௪_௫_௬_௭_௮_௯_௱௲_#,##,##0_廿_丗_卌_两_贰_叁_陆_初_兩_貳_參_陸", "numbers": "1_10_20_0_100_1000_10000_2_1000000000000_3_4_5_6_7_8_9_100000000_30_40_50_200_10000000000000000_1000000000000000000_60_70_80_90_300_400_500_600_700_800_900_2000_3000_10000000_4000_5000_11_15_16_17_6000_7000_8000_9000_21_31_41_12_13_14_18_19_1000000_51_61_71_81_91_20000_801_298_299_304_305_344_345_698_699_744_745_1001_2001_3001_100000_11000_1000000000_1000000000000000_200000000_2000000000000_20000000000000000_501_601_701_901_1000001_1100_1200_1300_1400_1500_1600_1700_1800_1900_2100_401_30000_40000_50000_60000_70000_80000_90000_200000_300000_400000_4001_5001_6001_7001_8001_9001" }; | ||
//# sourceMappingURL=autogen.rbnf.js.map |
import { Decimal } from '@phensley/decimal'; | ||
import { PluralRules } from '@phensley/plurals'; | ||
import { RuleType, RBNFRule } from './rbnftypes'; | ||
import { RBNFRule } from './rbnftypes'; | ||
import { RBNF as RBNFBase, RBNFDecimalFormatter, RBNFSet as RBNFSetBase, RBNFSymbols } from './rbnf'; | ||
@@ -5,0 +5,0 @@ export interface RBNFDebugSettings { |
127
lib/debug.js
@@ -5,2 +5,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RULETYPES = exports.OPCODES = exports.padright = exports.padleft = exports.RBNFDebugSet = exports.RBNF = void 0; | ||
var tslib_1 = require("tslib"); | ||
@@ -61,3 +62,3 @@ var rbnf_1 = require("./rbnf"); | ||
pct = (count / rules.length) * 100; | ||
console.log(exports.padleft(Math.floor(pct) + "%", 6), '[', exports.padleft("" + count, 2), '/', exports.padleft("" + rules.length, 2), ']', name_1); | ||
console.log((0, exports.padleft)("".concat(Math.floor(pct), "%"), 6), '[', (0, exports.padleft)("".concat(count), 2), '/', (0, exports.padleft)("".concat(rules.length), 2), ']', name_1); | ||
if (detail && pct < 100) { | ||
@@ -71,10 +72,12 @@ console.log(rpt); | ||
exports.RBNFDebugSet = RBNFDebugSet; | ||
exports.padleft = function (s, n) { | ||
var padleft = function (s, n) { | ||
var d = n - s.length; | ||
return ' '.repeat(d > 0 ? d : 0) + s; | ||
}; | ||
exports.padright = function (s, n) { | ||
exports.padleft = padleft; | ||
var padright = function (s, n) { | ||
var d = n - s.length; | ||
return s + ' '.repeat(d > 0 ? d : 0); | ||
}; | ||
exports.padright = padright; | ||
var RBNFDebugEngine = /** @class */ (function (_super) { | ||
@@ -96,3 +99,3 @@ tslib_1.__extends(RBNFDebugEngine, _super); | ||
} | ||
var id = "" + exports.padleft("[" + this.id + "]", 5); | ||
var id = "".concat((0, exports.padleft)("[".concat(this.id, "]"), 5)); | ||
var indent = ' '.repeat(this.depth); | ||
@@ -102,3 +105,3 @@ this.id++; | ||
if (this.settings.trace) { | ||
console.log.apply(console, tslib_1.__spreadArrays([indent, id, '>>'], s)); | ||
console.log.apply(console, tslib_1.__spreadArray([indent, id, '>>'], s, false)); | ||
} | ||
@@ -125,3 +128,3 @@ return function () { | ||
if (this.settings.trace) { | ||
t = this.trace("_evalinst '" + n.toString() + "' " + this.rbnf.allnames[si] + " " + rulerepr(this.rbnf, r)); | ||
t = this.trace("_evalinst '".concat(n.toString(), "' ").concat(this.rbnf.allnames[si], " ").concat(rulerepr(this.rbnf, r))); | ||
} | ||
@@ -143,21 +146,21 @@ _super.prototype._evalinst.call(this, n, i, r, ri, si); | ||
switch (rule[0]) { | ||
case 2 /* IMPROPER_FRACTION */: | ||
case 1 /* PROPER_FRACTION */: | ||
case 2 /* RuleType.IMPROPER_FRACTION */: | ||
case 1 /* RuleType.PROPER_FRACTION */: | ||
var sym = rule[2] === 1 ? ',' : '.'; | ||
res += "\"" + (rule[0] === 2 /* IMPROPER_FRACTION */ ? 'x' : '0') + sym + "x\""; | ||
res += "\"".concat(rule[0] === 2 /* RuleType.IMPROPER_FRACTION */ ? 'x' : '0').concat(sym, "x\""); | ||
break; | ||
case 0 /* MINUS */: | ||
case 0 /* RuleType.MINUS */: | ||
res += '"-x"'; | ||
break; | ||
case 5 /* INFINITY */: | ||
case 5 /* RuleType.INFINITY */: | ||
res += "\"Inf\""; | ||
break; | ||
case 6 /* NOT_A_NUMBER */: | ||
case 6 /* RuleType.NOT_A_NUMBER */: | ||
res += 'NaN'; | ||
break; | ||
case 3 /* NORMAL */: | ||
res += "\"" + rbnf.numbers[rule[2]] + "\""; | ||
case 3 /* RuleType.NORMAL */: | ||
res += "\"".concat(rbnf.numbers[rule[2]], "\""); | ||
break; | ||
case 4 /* NORMAL_RADIX */: | ||
res += "\"" + rbnf.numbers[rule[2]] + "/" + rbnf.numbers[rule[3]] + "\""; | ||
case 4 /* RuleType.NORMAL_RADIX */: | ||
res += "\"".concat(rbnf.numbers[rule[2]], "/").concat(rbnf.numbers[rule[3]], "\""); | ||
break; | ||
@@ -172,31 +175,31 @@ default: | ||
switch (i[0]) { | ||
case 13 /* APPLY_LEFT_NUM_FORMAT */: | ||
return "<" + rbnf.symbols[i[1]] + "<"; | ||
case 7 /* APPLY_LEFT_RULE */: | ||
return "<%" + rbnf.allnames[i[1]] + "%<"; | ||
case 14 /* APPLY_LEFT_2_NUM_FORMAT */: | ||
return "<" + rbnf.symbols[i[1]] + "<<"; | ||
case 11 /* APPLY_LEFT_2_RULE */: | ||
return "<%" + rbnf.allnames[i[1]] + "%<<"; | ||
case 3 /* APPLY_RIGHT_RULE */: | ||
return ">%" + rbnf.allnames[i[1]] + "%>"; | ||
case 2 /* OPTIONAL */: | ||
case 13 /* Opcode.APPLY_LEFT_NUM_FORMAT */: | ||
return "<".concat(rbnf.symbols[i[1]], "<"); | ||
case 7 /* Opcode.APPLY_LEFT_RULE */: | ||
return "<%".concat(rbnf.allnames[i[1]], "%<"); | ||
case 14 /* Opcode.APPLY_LEFT_2_NUM_FORMAT */: | ||
return "<".concat(rbnf.symbols[i[1]], "<<"); | ||
case 11 /* Opcode.APPLY_LEFT_2_RULE */: | ||
return "<%".concat(rbnf.allnames[i[1]], "%<<"); | ||
case 3 /* Opcode.APPLY_RIGHT_RULE */: | ||
return ">%".concat(rbnf.allnames[i[1]], "%>"); | ||
case 2 /* Opcode.OPTIONAL */: | ||
return '[' + i[1].map(function (_i) { return instrepr(rbnf, _i); }).join('') + ']'; | ||
case 0 /* LITERAL */: | ||
case 0 /* Opcode.LITERAL */: | ||
return rbnf.symbols[i[1]]; | ||
case 4 /* SUB_LEFT */: | ||
case 4 /* Opcode.SUB_LEFT */: | ||
return '<<'; | ||
case 1 /* SUB_RIGHT */: | ||
case 1 /* Opcode.SUB_RIGHT */: | ||
return '>>'; | ||
case 9 /* SUB_RIGHT_3 */: | ||
case 9 /* Opcode.SUB_RIGHT_3 */: | ||
return '>>>'; | ||
case 6 /* UNCHANGED_NUM_FORMAT */: | ||
return "=" + rbnf.symbols[i[1]] + "="; | ||
case 5 /* UNCHANGED_RULE */: | ||
return "=%" + rbnf.allnames[i[1]] + "%="; | ||
case 8 /* CARDINAL */: | ||
case 10 /* ORDINAL */: | ||
var r = i[0] === 8 /* CARDINAL */ ? 'cardinal' : 'ordinal'; | ||
var subs = i[1].map(function (s) { return REVPLURALS[s[0]] + "{" + rbnf.symbols[s[1]] + "}"; }).join(''); | ||
return "$(" + r + "," + subs + ")$"; | ||
case 6 /* Opcode.UNCHANGED_NUM_FORMAT */: | ||
return "=".concat(rbnf.symbols[i[1]], "="); | ||
case 5 /* Opcode.UNCHANGED_RULE */: | ||
return "=%".concat(rbnf.allnames[i[1]], "%="); | ||
case 8 /* Opcode.CARDINAL */: | ||
case 10 /* Opcode.ORDINAL */: | ||
var r = i[0] === 8 /* Opcode.CARDINAL */ ? 'cardinal' : 'ordinal'; | ||
var subs = i[1].map(function (s) { return "".concat(REVPLURALS[s[0]], "{").concat(rbnf.symbols[s[1]], "}"); }).join(''); | ||
return "$(".concat(r, ",").concat(subs, ")$"); | ||
default: | ||
@@ -207,27 +210,27 @@ return exports.OPCODES[i[0]]; | ||
exports.OPCODES = (_a = {}, | ||
_a[14 /* APPLY_LEFT_2_NUM_FORMAT */] = 'APPLY_LEFT_2_NUM_FORMAT', | ||
_a[11 /* APPLY_LEFT_2_RULE */] = 'APPLY_LEFT_2_RULE', | ||
_a[13 /* APPLY_LEFT_NUM_FORMAT */] = 'APPLY_LEFT_NUM_FORMAT', | ||
_a[7 /* APPLY_LEFT_RULE */] = 'APPLY_LEFT_RULE', | ||
_a[12 /* APPLY_RIGHT_NUM_FORMAT */] = 'APPLY_RIGHT_NUM_FORMAT', | ||
_a[3 /* APPLY_RIGHT_RULE */] = 'APPLY_RIGHT_RULE', | ||
_a[8 /* CARDINAL */] = 'CARDINAL', | ||
_a[0 /* LITERAL */] = 'LITERAL', | ||
_a[2 /* OPTIONAL */] = 'OPTIONAL', | ||
_a[10 /* ORDINAL */] = 'ORDINAL', | ||
_a[4 /* SUB_LEFT */] = 'SUB_LEFT', | ||
_a[1 /* SUB_RIGHT */] = 'SUB_RIGHT', | ||
_a[9 /* SUB_RIGHT_3 */] = 'SUB_RIGHT_3', | ||
_a[6 /* UNCHANGED_NUM_FORMAT */] = 'UNCHANGED_NUM_FORMAT', | ||
_a[5 /* UNCHANGED_RULE */] = 'UNCHANGED_RULE', | ||
_a[14 /* Opcode.APPLY_LEFT_2_NUM_FORMAT */] = 'APPLY_LEFT_2_NUM_FORMAT', | ||
_a[11 /* Opcode.APPLY_LEFT_2_RULE */] = 'APPLY_LEFT_2_RULE', | ||
_a[13 /* Opcode.APPLY_LEFT_NUM_FORMAT */] = 'APPLY_LEFT_NUM_FORMAT', | ||
_a[7 /* Opcode.APPLY_LEFT_RULE */] = 'APPLY_LEFT_RULE', | ||
_a[12 /* Opcode.APPLY_RIGHT_NUM_FORMAT */] = 'APPLY_RIGHT_NUM_FORMAT', | ||
_a[3 /* Opcode.APPLY_RIGHT_RULE */] = 'APPLY_RIGHT_RULE', | ||
_a[8 /* Opcode.CARDINAL */] = 'CARDINAL', | ||
_a[0 /* Opcode.LITERAL */] = 'LITERAL', | ||
_a[2 /* Opcode.OPTIONAL */] = 'OPTIONAL', | ||
_a[10 /* Opcode.ORDINAL */] = 'ORDINAL', | ||
_a[4 /* Opcode.SUB_LEFT */] = 'SUB_LEFT', | ||
_a[1 /* Opcode.SUB_RIGHT */] = 'SUB_RIGHT', | ||
_a[9 /* Opcode.SUB_RIGHT_3 */] = 'SUB_RIGHT_3', | ||
_a[6 /* Opcode.UNCHANGED_NUM_FORMAT */] = 'UNCHANGED_NUM_FORMAT', | ||
_a[5 /* Opcode.UNCHANGED_RULE */] = 'UNCHANGED_RULE', | ||
_a); | ||
exports.RULETYPES = (_b = {}, | ||
_b[2 /* IMPROPER_FRACTION */] = 'IMPROPER_FRACTION', | ||
_b[5 /* INFINITY */] = 'INFINITY', | ||
_b[0 /* MINUS */] = 'MINUS', | ||
_b[3 /* NORMAL */] = 'NORMAL', | ||
_b[4 /* NORMAL_RADIX */] = 'NORMAL_RADIX', | ||
_b[6 /* NOT_A_NUMBER */] = 'NOT_A_NUMBER', | ||
_b[1 /* PROPER_FRACTION */] = 'PROPER_FRACTION', | ||
_b[2 /* RuleType.IMPROPER_FRACTION */] = 'IMPROPER_FRACTION', | ||
_b[5 /* RuleType.INFINITY */] = 'INFINITY', | ||
_b[0 /* RuleType.MINUS */] = 'MINUS', | ||
_b[3 /* RuleType.NORMAL */] = 'NORMAL', | ||
_b[4 /* RuleType.NORMAL_RADIX */] = 'NORMAL_RADIX', | ||
_b[6 /* RuleType.NOT_A_NUMBER */] = 'NOT_A_NUMBER', | ||
_b[1 /* RuleType.PROPER_FRACTION */] = 'PROPER_FRACTION', | ||
_b); | ||
//# sourceMappingURL=debug.js.map |
import { Decimal } from '@phensley/decimal'; | ||
import { PluralRules } from '@phensley/plurals'; | ||
import { ApplyLeft2NumFormatInst, ApplyLeft2RuleInst, ApplyLeftNumFormatInst, ApplyLeftRuleInst, RBNFInst, RBNFRule, SubLeftInst } from './rbnftypes'; | ||
declare type IntegerSubInst = ApplyLeftRuleInst | ApplyLeft2RuleInst | ApplyLeft2NumFormatInst | ApplyLeftNumFormatInst | SubLeftInst; | ||
type IntegerSubInst = ApplyLeftRuleInst | ApplyLeft2RuleInst | ApplyLeft2NumFormatInst | ApplyLeftNumFormatInst | SubLeftInst; | ||
export interface RBNFSymbols { | ||
@@ -10,3 +10,3 @@ decimal: string; | ||
} | ||
export declare type RBNFDecimalFormatter = (pattern: string, n: Decimal) => string; | ||
export type RBNFDecimalFormatter = (pattern: string, n: Decimal) => string; | ||
/** | ||
@@ -13,0 +13,0 @@ * A collection of multiple RBNF locale-specific rulesets with shared arrays of |
101
lib/rbnf.js
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RBNFEngine = exports.RBNFSet = exports.RBNF = void 0; | ||
var decimal_1 = require("@phensley/decimal"); | ||
@@ -9,3 +10,3 @@ var rbnftypes_1 = require("./rbnftypes"); | ||
// This table stops just past the largest base value found in the RBNF dataset. | ||
var DIVISORS = [0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18].map(function (e) { return new decimal_1.Decimal("1e" + e); }); | ||
var DIVISORS = [0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18].map(function (e) { return new decimal_1.Decimal("1e".concat(e)); }); | ||
var ONE = decimal_1.DecimalConstants.ONE, ZERO = decimal_1.DecimalConstants.ZERO; | ||
@@ -114,3 +115,3 @@ var MINUS_ONE = ONE.negate(); | ||
if (this.errors.length) { | ||
console.log("ERRORS: '" + this.language + "' rule '" + name + "' number '" + n.toString() + "' " + this.errors.join('\n')); | ||
console.log("ERRORS: '".concat(this.language, "' rule '").concat(name, "' number '").concat(n.toString(), "' ").concat(this.errors.join('\n'))); | ||
} | ||
@@ -142,3 +143,3 @@ return this.buf; | ||
switch (r[0]) { | ||
case 6 /* NOT_A_NUMBER */: | ||
case 6 /* RuleType.NOT_A_NUMBER */: | ||
if (n.isNaN()) { | ||
@@ -148,3 +149,3 @@ return { value: i }; | ||
break; | ||
case 5 /* INFINITY */: | ||
case 5 /* RuleType.INFINITY */: | ||
if (n.isInfinity()) { | ||
@@ -154,3 +155,3 @@ return { value: i }; | ||
break; | ||
case 0 /* MINUS */: | ||
case 0 /* RuleType.MINUS */: | ||
if (neg) { | ||
@@ -160,3 +161,3 @@ return { value: i }; | ||
break; | ||
case 1 /* PROPER_FRACTION */: | ||
case 1 /* RuleType.PROPER_FRACTION */: | ||
if (!int && | ||
@@ -169,3 +170,3 @@ fin && | ||
break; | ||
case 2 /* IMPROPER_FRACTION */: | ||
case 2 /* RuleType.IMPROPER_FRACTION */: | ||
// If present it always follows a proper fraction rule, catching anything that falls through | ||
@@ -176,10 +177,10 @@ if (!int && fin && r[2] === this_1.decimal) { | ||
break; | ||
case 3 /* NORMAL */: | ||
case 4 /* NORMAL_RADIX */: | ||
case 3 /* RuleType.NORMAL */: | ||
case 4 /* RuleType.NORMAL_RADIX */: | ||
if (fin) { | ||
var m_1 = n.abs(); | ||
var j = utils_1.binarySearch(rules, true, i, function (e) { return _this.rbnf.numbers[e[2]].compare(m_1); }); | ||
var j = (0, utils_1.binarySearch)(rules, true, i, function (e) { return _this.rbnf.numbers[e[2]].compare(m_1); }); | ||
if (j < i) { | ||
var name_1 = this_1.rbnf.allnames[si]; | ||
this_1.errors.push("Malformed rules in ruleset '" + name_1 + "' at " + i + " for " + n.toString() + ": got " + j); | ||
this_1.errors.push("Malformed rules in ruleset '".concat(name_1, "' at ").concat(i, " for ").concat(n.toString(), ": got ").concat(j)); | ||
return { value: -1 }; | ||
@@ -204,6 +205,6 @@ } | ||
switch (inst[0]) { | ||
case 0 /* LITERAL */: | ||
case 0 /* Opcode.LITERAL */: | ||
this_2.symbol(inst[1]); | ||
break; | ||
case 2 /* OPTIONAL */: | ||
case 2 /* Opcode.OPTIONAL */: | ||
// If number is not a multiple of radix, execute the optional block | ||
@@ -214,6 +215,6 @@ if (ZERO.compare(n.divmod(this_2.getradix(r))[1]) !== 0) { | ||
break; | ||
case 8 /* CARDINAL */: | ||
case 10 /* ORDINAL */: | ||
case 8 /* Opcode.CARDINAL */: | ||
case 10 /* Opcode.ORDINAL */: | ||
var q = n.divmod(this_2.getradix(r))[0]; | ||
var cat_1 = this_2.plural(q.stripTrailingZeros(), inst[0] === 8 /* CARDINAL */); | ||
var cat_1 = this_2.plural(q.stripTrailingZeros(), inst[0] === 8 /* Opcode.CARDINAL */); | ||
// Select string matching plural category, and fall back to 'other' | ||
@@ -228,12 +229,12 @@ var subs = inst[1].filter(function (s) { return s[0] === cat_1; }); | ||
break; | ||
case 4 /* SUB_LEFT */: | ||
case 7 /* APPLY_LEFT_RULE */: | ||
case 11 /* APPLY_LEFT_2_RULE */: | ||
case 13 /* APPLY_LEFT_NUM_FORMAT */: | ||
case 14 /* APPLY_LEFT_2_NUM_FORMAT */: | ||
if (r[0] === 1 /* PROPER_FRACTION */ || r[0] === 2 /* IMPROPER_FRACTION */) { | ||
case 4 /* Opcode.SUB_LEFT */: | ||
case 7 /* Opcode.APPLY_LEFT_RULE */: | ||
case 11 /* Opcode.APPLY_LEFT_2_RULE */: | ||
case 13 /* Opcode.APPLY_LEFT_NUM_FORMAT */: | ||
case 14 /* Opcode.APPLY_LEFT_2_NUM_FORMAT */: | ||
if (r[0] === 1 /* RuleType.PROPER_FRACTION */ || r[0] === 2 /* RuleType.IMPROPER_FRACTION */) { | ||
this_2.integersub(n, inst, ri, si); | ||
} | ||
else if (this_2.fractions.has(si)) { | ||
var base = r[0] === 3 /* NORMAL */ || r[0] === 4 /* NORMAL_RADIX */ ? r[2] : -1; | ||
var base = r[0] === 3 /* RuleType.NORMAL */ || r[0] === 4 /* RuleType.NORMAL_RADIX */ ? r[2] : -1; | ||
if (base !== -1) { | ||
@@ -247,15 +248,15 @@ this_2.numeratorsub(n, inst, base, ri, si); | ||
break; | ||
case 5 /* UNCHANGED_RULE */: | ||
case 5 /* Opcode.UNCHANGED_RULE */: | ||
this_2._format(n, inst[1]); | ||
break; | ||
case 6 /* UNCHANGED_NUM_FORMAT */: | ||
case 6 /* Opcode.UNCHANGED_NUM_FORMAT */: | ||
this_2.buf += this_2.fallback(this_2.rbnf.symbols[inst[1]], n); | ||
break; | ||
case 1 /* SUB_RIGHT */: | ||
case 9 /* SUB_RIGHT_3 */: | ||
case 3 /* APPLY_RIGHT_RULE */: | ||
if (r[0] === 0 /* MINUS */) { | ||
this_2._format(n.abs(), inst[0] === 3 /* APPLY_RIGHT_RULE */ ? inst[1] : si); | ||
case 1 /* Opcode.SUB_RIGHT */: | ||
case 9 /* Opcode.SUB_RIGHT_3 */: | ||
case 3 /* Opcode.APPLY_RIGHT_RULE */: | ||
if (r[0] === 0 /* RuleType.MINUS */) { | ||
this_2._format(n.abs(), inst[0] === 3 /* Opcode.APPLY_RIGHT_RULE */ ? inst[1] : si); | ||
} | ||
else if (r[0] === 1 /* PROPER_FRACTION */ || r[0] === 2 /* IMPROPER_FRACTION */) { | ||
else if (r[0] === 1 /* RuleType.PROPER_FRACTION */ || r[0] === 2 /* RuleType.IMPROPER_FRACTION */) { | ||
var m = n.abs(); | ||
@@ -283,5 +284,5 @@ this_2.fractionsub(m.subtract(m.toInteger()), inst, ri, si); | ||
RBNFEngine.prototype.fractionsub = function (n, inst, ri, si) { | ||
var _si = inst[0] === 3 /* APPLY_RIGHT_RULE */ ? inst[1] : si; | ||
var digits = inst[0] === 1 /* SUB_RIGHT */ || inst[0] === 9 /* SUB_RIGHT_3 */ || _si === si; | ||
var spaces = inst[0] !== 9 /* SUB_RIGHT_3 */; | ||
var _si = inst[0] === 3 /* Opcode.APPLY_RIGHT_RULE */ ? inst[1] : si; | ||
var digits = inst[0] === 1 /* Opcode.SUB_RIGHT */ || inst[0] === 9 /* Opcode.SUB_RIGHT_3 */ || _si === si; | ||
var spaces = inst[0] !== 9 /* Opcode.SUB_RIGHT_3 */; | ||
if (digits) { | ||
@@ -296,3 +297,3 @@ this.bydigit(n, ri, si, spaces); | ||
var t_1 = q.shiftleft(q.scale()).toInteger(); | ||
var m = utils_1.binarySearch(DIVISORS, false, 0, function (e) { | ||
var m = (0, utils_1.binarySearch)(DIVISORS, false, 0, function (e) { | ||
var r = e.compare(t_1); | ||
@@ -313,9 +314,9 @@ return r; | ||
switch (inst[0]) { | ||
case 7 /* APPLY_LEFT_RULE */: | ||
case 11 /* APPLY_LEFT_2_RULE */: | ||
case 4 /* SUB_LEFT */: | ||
this._format(n, inst[0] === 4 /* SUB_LEFT */ ? si : inst[1]); | ||
case 7 /* Opcode.APPLY_LEFT_RULE */: | ||
case 11 /* Opcode.APPLY_LEFT_2_RULE */: | ||
case 4 /* Opcode.SUB_LEFT */: | ||
this._format(n, inst[0] === 4 /* Opcode.SUB_LEFT */ ? si : inst[1]); | ||
break; | ||
case 13 /* APPLY_LEFT_NUM_FORMAT */: | ||
case 14 /* APPLY_LEFT_2_NUM_FORMAT */: | ||
case 13 /* Opcode.APPLY_LEFT_NUM_FORMAT */: | ||
case 14 /* Opcode.APPLY_LEFT_2_NUM_FORMAT */: | ||
// TODO: implement number format | ||
@@ -328,3 +329,3 @@ this.buf += '#'; | ||
switch (inst[0]) { | ||
case 11 /* APPLY_LEFT_2_RULE */: | ||
case 11 /* Opcode.APPLY_LEFT_2_RULE */: | ||
this._format(n, inst[1]); | ||
@@ -337,5 +338,5 @@ break; | ||
switch (inst[0]) { | ||
case 7 /* APPLY_LEFT_RULE */: | ||
case 4 /* SUB_LEFT */: | ||
this._format(q, inst[0] === 4 /* SUB_LEFT */ ? si : inst[1]); | ||
case 7 /* Opcode.APPLY_LEFT_RULE */: | ||
case 4 /* Opcode.SUB_LEFT */: | ||
this._format(q, inst[0] === 4 /* Opcode.SUB_LEFT */ ? si : inst[1]); | ||
break; | ||
@@ -351,5 +352,5 @@ default: | ||
switch (inst[0]) { | ||
case 3 /* APPLY_RIGHT_RULE */: | ||
case 1 /* SUB_RIGHT */: | ||
this._format(r, inst[0] === 1 /* SUB_RIGHT */ ? si : inst[1]); | ||
case 3 /* Opcode.APPLY_RIGHT_RULE */: | ||
case 1 /* Opcode.SUB_RIGHT */: | ||
this._format(r, inst[0] === 1 /* Opcode.SUB_RIGHT */ ? si : inst[1]); | ||
break; | ||
@@ -380,5 +381,5 @@ } | ||
var n = this.rbnf.numbers; | ||
return r[0] === 4 /* NORMAL_RADIX */ | ||
return r[0] === 4 /* RuleType.NORMAL_RADIX */ | ||
? n[r[3]] | ||
: r[0] === 3 /* NORMAL */ | ||
: r[0] === 3 /* RuleType.NORMAL */ | ||
? DIVISORS[n[r[2]].integerDigits()] | ||
@@ -385,0 +386,0 @@ : TEN; |
@@ -19,4 +19,4 @@ /** | ||
} | ||
export declare type AtomType = RuleType.MINUS | RuleType.INFINITY | RuleType.NOT_A_NUMBER; | ||
export declare type FractionType = RuleType.PROPER_FRACTION | RuleType.IMPROPER_FRACTION; | ||
export type AtomType = RuleType.MINUS | RuleType.INFINITY | RuleType.NOT_A_NUMBER; | ||
export type FractionType = RuleType.PROPER_FRACTION | RuleType.IMPROPER_FRACTION; | ||
/** | ||
@@ -54,3 +54,3 @@ * An atom rule has a type and one or more instructions to evaluate. | ||
} | ||
export declare type RBNFRule = AtomRule | FractionRule | NormalRule | NormalRadixRule; | ||
export type RBNFRule = AtomRule | FractionRule | NormalRule | NormalRadixRule; | ||
/** | ||
@@ -146,5 +146,5 @@ * Instruction opcodes, sorted from most- to least-frequent. | ||
} | ||
export declare type RBNFInst = LiteralInst | ApplyLeftRuleInst | ApplyLeftNumFormatInst | ApplyLeft2RuleInst | ApplyLeft2NumFormatInst | ApplyRightRuleInst | ApplyRightNumFormatInst | CardinalInst | OrdinalInst | OptionalInst | SubLeftInst | SubRightInst | SubRight3Inst | UnchangedRuleInst | UnchangedNumFormatInst; | ||
export type RBNFInst = LiteralInst | ApplyLeftRuleInst | ApplyLeftNumFormatInst | ApplyLeft2RuleInst | ApplyLeft2NumFormatInst | ApplyRightRuleInst | ApplyRightNumFormatInst | CardinalInst | OrdinalInst | OptionalInst | SubLeftInst | SubRightInst | SubRight3Inst | UnchangedRuleInst | UnchangedNumFormatInst; | ||
export declare const PLURALS: { | ||
[x: string]: number; | ||
}; |
@@ -9,2 +9,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PLURALS = void 0; | ||
// Mapping from string name of plural category to rbnf equivalent | ||
@@ -11,0 +12,0 @@ exports.PLURALS = { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.binarySearch = void 0; | ||
/** | ||
@@ -9,3 +10,3 @@ * Binary search into the array of T, using the return value of 'f' to | ||
*/ | ||
exports.binarySearch = function (elems, lessThan, lo, f) { | ||
var binarySearch = function (elems, lessThan, lo, f) { | ||
var hi = elems.length - 1; | ||
@@ -32,2 +33,3 @@ var mid = 0; | ||
}; | ||
exports.binarySearch = binarySearch; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@phensley/cldr-ext-rbnf", | ||
"version": "1.2.13", | ||
"version": "1.2.14", | ||
"description": "Extension for rule-based number formatting", | ||
@@ -39,6 +39,6 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@phensley/cldr-types": "~1.2.13", | ||
"@phensley/decimal": "~1.2.13", | ||
"@phensley/plurals": "~1.2.13", | ||
"tslib": "^1.13.0" | ||
"@phensley/cldr-types": "~1.2.14", | ||
"@phensley/decimal": "~1.2.14", | ||
"@phensley/plurals": "~1.2.14", | ||
"tslib": "^2.3.1" | ||
}, | ||
@@ -49,15 +49,15 @@ "devDependencies": { | ||
"@types/node": "^14.0.1", | ||
"@typescript-eslint/eslint-plugin": "^2.33.0", | ||
"@typescript-eslint/parser": "^2.33.0", | ||
"@typescript-eslint/eslint-plugin": "5.55.0", | ||
"@typescript-eslint/parser": "5.55.0", | ||
"beautify-benchmark": "^0.2.4", | ||
"benchmark": "^2.1.4", | ||
"chalk": "^4.0.0", | ||
"eslint": "^7.0.0", | ||
"eslint": "^8.32.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"jest": "^26.0.1", | ||
"jest": "25.5.4", | ||
"prettier": "^2.0.5", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^25.5.1", | ||
"typescript": "~3.8.3" | ||
"ts-jest": "25.5.1", | ||
"typescript": "4.9.4" | ||
}, | ||
@@ -77,3 +77,3 @@ "jest": { | ||
}, | ||
"gitHead": "1649a9047668bc4519d33526f50174ba3f2e2d32" | ||
"gitHead": "bea64f8ab05fb48af97cfa88b1293e0b17d2ed0d" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
553429
2467
- Removedtslib@1.14.1(transitive)
Updated@phensley/cldr-types@~1.2.14
Updated@phensley/decimal@~1.2.14
Updated@phensley/plurals@~1.2.14
Updatedtslib@^2.3.1