diff --git a/.eslintignore b/.eslintignore
index 1ff82b3e49..80052ad8b0 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -5,5 +5,4 @@
**/artifacts
**/build
**/node_modules
-packages/intl-messageformat-parser/src/parser.ts
packages/babel-plugin-formatjs/options.ts
\ No newline at end of file
diff --git a/.gitattributes b/.gitattributes
index 072ba063bb..604286a6e7 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,6 +1,5 @@
packages/*/src/data/* linguist-generated
packages/*/test262-main.ts linguist-generated
packages/*/tests/locale-data/* linguist-generated
-packages/intl-messageformat-parser/src/parser.ts linguist-generated
website/* linguist-documentation
**/CHANGELOG.md linguist-documentation
\ No newline at end of file
diff --git a/.prettierignore b/.prettierignore
index a538e62ad0..74ad1869d5 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -6,7 +6,6 @@ packages/*/CHANGELOG.md
packages/babel-plugin-formatjs/options.ts
packages/intl-datetimeformat/src/data/
packages/intl-getcanonicallocales/src/data/
-packages/intl-messageformat-parser/src/parser.ts
packages/intl-numberformat/src/data/
packages/ecma402-abstract/src/NumberFormat/digit-mapping.json
packages/cli/tests/extract/typescript/err.tsx
diff --git a/BUILD b/BUILD
index 0a28fd9324..7489fbd778 100644
--- a/BUILD
+++ b/BUILD
@@ -102,7 +102,6 @@ multirun(
"//packages/intl-listformat:prettier",
"//packages/intl-locale:prettier",
"//packages/intl-localematcher:prettier",
- "//packages/intl-messageformat-parser:prettier",
"//packages/intl-messageformat:prettier",
"//packages/intl-numberformat:prettier",
"//packages/intl-pluralrules:prettier",
diff --git a/package-lock.json b/package-lock.json
index a1ef735c90..84e9c488d6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -77,6 +77,7 @@
"hoist-non-react-statics": "^3.3.2",
"http-server": "^0.12.3",
"husky": "^6.0.0",
+ "intl-messageformat-parser": "^6.4.4",
"jasmine-expect": "^5.0.0",
"jest": "26",
"json-stable-stringify": "^1.0.1",
@@ -2979,6 +2980,15 @@
"node": ">=8"
}
},
+ "node_modules/@formatjs/ecma402-abstract": {
+ "version": "1.6.4",
+ "resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-1.6.4.tgz",
+ "integrity": "sha512-ukFjGD9dLsxcD9D5AEshJqQElPQeUAlTALT/lzIV6OcYojyuU81gw/uXDUOrs6XW79jtOJwQDkLqHbCJBJMOTw==",
+ "dev": true,
+ "dependencies": {
+ "tslib": "^2.1.0"
+ }
+ },
"node_modules/@hapi/hoek": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.1.1.tgz",
@@ -18157,6 +18167,17 @@
"node": ">= 0.10"
}
},
+ "node_modules/intl-messageformat-parser": {
+ "version": "6.4.4",
+ "resolved": "https://registry.npmjs.org/intl-messageformat-parser/-/intl-messageformat-parser-6.4.4.tgz",
+ "integrity": "sha512-7AaFKNZEfzLQR6+jivOuz9e7yA8ka5KrmLebgY4QHTRLf8r64dp3LjnW98LkBWjdk8GK0sawD2dHDqW++A/pXA==",
+ "deprecated": "We've written a new parser that's 6x faster and is backwards compatible. Please use @formatjs/icu-messageformat-parser",
+ "dev": true,
+ "dependencies": {
+ "@formatjs/ecma402-abstract": "1.6.4",
+ "tslib": "^2.1.0"
+ }
+ },
"node_modules/into-stream": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz",
@@ -44964,6 +44985,15 @@
}
}
},
+ "@formatjs/ecma402-abstract": {
+ "version": "1.6.4",
+ "resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-1.6.4.tgz",
+ "integrity": "sha512-ukFjGD9dLsxcD9D5AEshJqQElPQeUAlTALT/lzIV6OcYojyuU81gw/uXDUOrs6XW79jtOJwQDkLqHbCJBJMOTw==",
+ "dev": true,
+ "requires": {
+ "tslib": "^2.1.0"
+ }
+ },
"@hapi/hoek": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.1.1.tgz",
@@ -57286,6 +57316,16 @@
"integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==",
"dev": true
},
+ "intl-messageformat-parser": {
+ "version": "6.4.4",
+ "resolved": "https://registry.npmjs.org/intl-messageformat-parser/-/intl-messageformat-parser-6.4.4.tgz",
+ "integrity": "sha512-7AaFKNZEfzLQR6+jivOuz9e7yA8ka5KrmLebgY4QHTRLf8r64dp3LjnW98LkBWjdk8GK0sawD2dHDqW++A/pXA==",
+ "dev": true,
+ "requires": {
+ "@formatjs/ecma402-abstract": "1.6.4",
+ "tslib": "^2.1.0"
+ }
+ },
"into-stream": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz",
diff --git a/package.json b/package.json
index 34141677f3..71536427a2 100644
--- a/package.json
+++ b/package.json
@@ -87,6 +87,7 @@
"hoist-non-react-statics": "^3.3.2",
"http-server": "^0.12.3",
"husky": "^6.0.0",
+ "intl-messageformat-parser": "^6.4.4",
"jasmine-expect": "^5.0.0",
"jest": "26",
"json-stable-stringify": "^1.0.1",
diff --git a/packages/editor/BUILD b/packages/editor/BUILD
index abe0135f3b..8ea47d640c 100644
--- a/packages/editor/BUILD
+++ b/packages/editor/BUILD
@@ -40,7 +40,7 @@ SRC_DEPS = [
"@npm//react-dom",
"@npm//@types/react-dom",
"//packages/react-intl:dist",
- "//packages/intl-messageformat-parser:dist",
+ "//packages/icu-messageformat-parser:dist",
]
ts_compile(
diff --git a/packages/editor/message.tsx b/packages/editor/message.tsx
index 098fb7e356..6cf5f83c90 100644
--- a/packages/editor/message.tsx
+++ b/packages/editor/message.tsx
@@ -9,7 +9,7 @@ import {
isTagElement,
MessageFormatElement,
isArgumentElement,
-} from 'intl-messageformat-parser'
+} from '@formatjs/icu-messageformat-parser'
interface Props {
message: string
diff --git a/packages/editor/package.json b/packages/editor/package.json
index a836f7ef86..71c807cf68 100644
--- a/packages/editor/package.json
+++ b/packages/editor/package.json
@@ -33,7 +33,8 @@
"@material-ui/lab": "4.0.0-alpha.57",
"react": "17",
"@types/react": "16",
- "react-intl": "5.15.5"
+ "react-intl": "5.15.5",
+ "@formatjs/icu-messageformat-parser": "1.1.2"
},
"bugs": {
"url": "https://github.com/formatjs/formatjs/issues"
diff --git a/packages/icu-messageformat-parser/BUILD b/packages/icu-messageformat-parser/BUILD
index bbe2048198..73f0d13bc4 100644
--- a/packages/icu-messageformat-parser/BUILD
+++ b/packages/icu-messageformat-parser/BUILD
@@ -59,7 +59,7 @@ nodejs_binary(
data = [
":dist",
"@npm//benchmark",
- "//packages/intl-messageformat-parser:dist",
+ "@npm//intl-messageformat-parser",
"benchmark.js",
] + SRC_DEPS,
entry_point = "benchmark.js",
diff --git a/packages/intl-messageformat-parser/BUILD b/packages/intl-messageformat-parser/BUILD
deleted file mode 100644
index fec4b1ee81..0000000000
--- a/packages/intl-messageformat-parser/BUILD
+++ /dev/null
@@ -1,119 +0,0 @@
-load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test", "nodejs_binary", "pkg_npm")
-load("@npm//ts-node:index.bzl", "ts_node")
-load("//tools:index.bzl", "check_format", "ts_compile")
-load("//tools:jest.bzl", "jest_test")
-
-PACKAGE_NAME = "intl-messageformat-parser"
-
-pkg_npm(
- name = PACKAGE_NAME,
- package_name = PACKAGE_NAME,
- srcs = [
- "LICENSE.md",
- "README.md",
- ],
- deps = [
- ":dist",
- ],
-)
-
-alias(
- name = "publish",
- actual = "%s.publish" % PACKAGE_NAME,
-)
-
-alias(
- name = "pack",
- actual = "%s.pack" % PACKAGE_NAME,
-)
-
-SRCS = glob(["src/*.ts"]) + [
- "index.ts",
- "no-parser.ts",
-]
-
-SRC_DEPS = [
- "//packages/ecma402-abstract:dist",
-]
-
-ts_compile(
- name = "dist",
- package_name = PACKAGE_NAME,
- srcs = SRCS,
- skip_esm = False,
- deps = SRC_DEPS,
-)
-
-jest_test(
- name = "unit",
- srcs = SRCS + glob([
- "tests/**/*.ts",
- "tests/**/*.tsx",
- "tests/**/*.snap",
- ]),
- deps = [
- "//packages/ecma402-abstract:types",
- ] + SRC_DEPS,
-)
-
-# parser
-nodejs_binary(
- name = "parser-build",
- data = [
- "src/parser.pegjs",
- "tools/build.js",
- "@npm//fs-extra",
- "@npm//minimist",
- "@npm//pegjs",
- "@npm//ts-pegjs",
- "@npm//tslib",
- ],
- entry_point = "tools/build.js",
- templated_args = ["--bazel_patch_module_resolver"],
-)
-
-genrule(
- name = "parser-gen",
- srcs = ["src/parser.pegjs"],
- outs = ["tmp/parser.ts"],
- cmd = "$(location :parser-build) --input $(location src/parser.pegjs) --out $@",
- tools = [":parser-build"],
-)
-
-generated_file_test(
- name = "parser",
- src = "src/parser.ts",
- generated = ":parser-gen",
-)
-
-ts_node(
- name = "benchmark",
- args = [
- "$(execpath tests/benchmark.js)",
- ],
- data = [
- "@npm//benchmark",
- "tests/benchmark.js",
- ] + SRCS + SRC_DEPS,
-)
-
-generated_file_test(
- name = "tsconfig_json",
- src = "tsconfig.json",
- generated = "//tools:tsconfig.golden.json",
-)
-
-check_format(
- name = "prettier",
- srcs = glob(
- [
- "**/*",
- ],
- exclude = [
- "CHANGELOG.md",
- "src/parser.pegjs",
- "src/parser.ts",
- "tests/__snapshots__/*",
- ],
- ),
-)
diff --git a/packages/intl-messageformat-parser/CHANGELOG.md b/packages/intl-messageformat-parser/CHANGELOG.md
deleted file mode 100644
index 8557092b79..0000000000
--- a/packages/intl-messageformat-parser/CHANGELOG.md
+++ /dev/null
@@ -1,1188 +0,0 @@
-# Change Log
-
-All notable changes to this project will be documented in this file.
-See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
-
-## [6.4.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.4.3...intl-messageformat-parser@6.4.4) (2021-03-26)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.4.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.4.2...intl-messageformat-parser@6.4.3) (2021-03-15)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.4.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.4.1...intl-messageformat-parser@6.4.2) (2021-03-01)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.4.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.4.0...intl-messageformat-parser@6.4.1) (2021-02-25)
-
-
-### Bug Fixes
-
-* bump tslib version dep ([37577d2](https://github.com/formatjs/formatjs/commit/37577d22bf28d23de1d8013ba0047cf221ad8840)), closes [#2645](https://github.com/formatjs/formatjs/issues/2645)
-
-
-
-
-
-# [6.4.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.3.4...intl-messageformat-parser@6.4.0) (2021-02-25)
-
-
-### Features
-
-* **intl-messageformat-parser:** support TS4.2 ([aa756c1](https://github.com/formatjs/formatjs/commit/aa756c1314d20057a6e7563185f53d1884977094))
-
-
-
-
-
-## [6.3.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.3.3...intl-messageformat-parser@6.3.4) (2021-02-22)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.3.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.3.2...intl-messageformat-parser@6.3.3) (2021-02-21)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.3.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.3.1...intl-messageformat-parser@6.3.2) (2021-02-13)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.3.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.3.0...intl-messageformat-parser@6.3.1) (2021-01-27)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-# [6.3.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.2.0...intl-messageformat-parser@6.3.0) (2021-01-26)
-
-
-### Features
-
-* **intl-messageformat-parser:** support more concise skeleton, fix [#2512](https://github.com/formatjs/formatjs/issues/2512) ([6be7988](https://github.com/formatjs/formatjs/commit/6be7988aef05ea906bbae3fbf419a551376ad5cc))
-
-
-
-
-
-# [6.2.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.1.3...intl-messageformat-parser@6.2.0) (2021-01-25)
-
-
-### Features
-
-* **intl-messageformat-parser:** support integer-width (full & concise form), fix [#2525](https://github.com/formatjs/formatjs/issues/2525) ([01e4715](https://github.com/formatjs/formatjs/commit/01e47158f949a52f947f45e500dc694e209d7b72))
-
-
-
-
-
-## [6.1.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.1.2...intl-messageformat-parser@6.1.3) (2021-01-05)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.1.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.1.1...intl-messageformat-parser@6.1.2) (2021-01-02)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.1.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.1.0...intl-messageformat-parser@6.1.1) (2021-01-01)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-# [6.1.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.18...intl-messageformat-parser@6.1.0) (2020-12-17)
-
-
-### Features
-
-* **intl-messageformat-parser:** record scale stem in number skeleton, fix [#2414](https://github.com/formatjs/formatjs/issues/2414) ([3419140](https://github.com/formatjs/formatjs/commit/3419140096ea413b4c9dc9f4f8d44318a7e5ae09))
-
-
-
-
-
-## [6.0.18](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.17...intl-messageformat-parser@6.0.18) (2020-11-27)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.17](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.16...intl-messageformat-parser@6.0.17) (2020-11-20)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.16](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.15...intl-messageformat-parser@6.0.16) (2020-11-12)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.15](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.14...intl-messageformat-parser@6.0.15) (2020-11-09)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.14](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.13...intl-messageformat-parser@6.0.14) (2020-11-09)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.13](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.12...intl-messageformat-parser@6.0.13) (2020-11-05)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** lock down monorepo dep version ([ef349c8](https://github.com/formatjs/formatjs/commit/ef349c8a52a68cfe19d13dcaf5ec754dcaca24ce))
-
-
-
-
-
-## [6.0.12](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.11...intl-messageformat-parser@6.0.12) (2020-11-04)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.11](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.10...intl-messageformat-parser@6.0.11) (2020-10-25)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.10](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.9...intl-messageformat-parser@6.0.10) (2020-10-10)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.9](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.8...intl-messageformat-parser@6.0.9) (2020-10-08)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.8](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.7...intl-messageformat-parser@6.0.8) (2020-10-01)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.7](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.6...intl-messageformat-parser@6.0.7) (2020-09-18)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.6](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.5...intl-messageformat-parser@6.0.6) (2020-09-09)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.5](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.4...intl-messageformat-parser@6.0.5) (2020-08-28)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.3...intl-messageformat-parser@6.0.4) (2020-08-25)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.2...intl-messageformat-parser@6.0.3) (2020-08-22)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@6.0.1...intl-messageformat-parser@6.0.2) (2020-08-21)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [6.0.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.5.1...intl-messageformat-parser@6.0.1) (2020-08-20)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** bump version to 6.0 ([1864c13](https://github.com/formatjs/formatjs/commit/1864c13d28a4f0b1bb0269dfec2eb3c65698646e))
-
-
-
-
-
-## [5.5.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.5.0...intl-messageformat-parser@5.5.1) (2020-08-19)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-# [5.5.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.4.2...intl-messageformat-parser@5.5.0) (2020-08-19)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** rm skeleton export from dummy ([986290f](https://github.com/formatjs/formatjs/commit/986290f02a13e9028cf0dab08d8c198790cd6bb9))
-
-
-### Features
-
-* **intl-messageformat-parser:** add shouldParseSkeleton flag to parse skeleton into ECMA402 format options ([ff84995](https://github.com/formatjs/formatjs/commit/ff8499540c8ddb12ad10d897b348671a607c40f9))
-
-
-
-
-
-## [5.4.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.4.1...intl-messageformat-parser@5.4.2) (2020-08-18)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.4.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.4.0...intl-messageformat-parser@5.4.1) (2020-08-17)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-# [5.4.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.3.9...intl-messageformat-parser@5.4.0) (2020-08-14)
-
-
-### Features
-
-* **intl-messageformat-parser:** expose intl-messageformat-parser/dummy that does not contains parser ([d0e2d7e](https://github.com/formatjs/formatjs/commit/d0e2d7ea0a91abb9dc0f6c9b7018d91a367d4060))
-
-
-
-
-
-## [5.3.9](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.3.8...intl-messageformat-parser@5.3.9) (2020-08-14)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.3.8](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.3.7...intl-messageformat-parser@5.3.8) (2020-08-13)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.3.7](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.3.6...intl-messageformat-parser@5.3.7) (2020-07-24)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.3.6](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.3.5...intl-messageformat-parser@5.3.6) (2020-07-21)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** no need to escape less than sign in messages ([#1857](https://github.com/formatjs/formatjs/issues/1857)) ([8897c96](https://github.com/formatjs/formatjs/commit/8897c9620c747557acaa917ff68a1e166788ac0a)), closes [#1845](https://github.com/formatjs/formatjs/issues/1845)
-
-
-
-
-
-## [5.3.5](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.3.4...intl-messageformat-parser@5.3.5) (2020-07-17)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.3.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.3.3...intl-messageformat-parser@5.3.4) (2020-07-16)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.3.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.3.1...intl-messageformat-parser@5.3.3) (2020-07-14)
-
-
-### Bug Fixes
-
-* **react-intl:** fix rollup'ed type def file ([bddb88e](https://github.com/formatjs/formatjs/commit/bddb88e7435854b3152f2fbdc72b50054d9bad76))
-
-
-
-
-
-## [5.3.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.3.1...intl-messageformat-parser@5.3.2) (2020-07-14)
-
-
-### Bug Fixes
-
-* **react-intl:** fix rollup'ed type def file ([bddb88e](https://github.com/formatjs/formatjs/commit/bddb88e7435854b3152f2fbdc72b50054d9bad76))
-
-
-
-
-
-## [5.3.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.3.0...intl-messageformat-parser@5.3.1) (2020-07-14)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-# [5.3.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.2.4...intl-messageformat-parser@5.3.0) (2020-07-14)
-
-
-### Features
-
-* publish ([b6e3465](https://github.com/formatjs/formatjs/commit/b6e3465ac95b3fa481f3c89f077a66ac004f7c27))
-
-
-
-
-
-## [5.2.5](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.2.4...intl-messageformat-parser@5.2.5) (2020-07-09)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.2.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.2.3...intl-messageformat-parser@5.2.4) (2020-07-03)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.2.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.2.2...intl-messageformat-parser@5.2.3) (2020-07-03)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.2.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.2.1...intl-messageformat-parser@5.2.2) (2020-07-03)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.2.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.2.0...intl-messageformat-parser@5.2.1) (2020-07-01)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-# [5.2.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.1.6...intl-messageformat-parser@5.2.0) (2020-06-26)
-
-
-### Features
-
-* **intl-messageformat:** pass `ignoreTag` to parser ([386459b](https://github.com/formatjs/formatjs/commit/386459ba472734ff21ba19374e2700e52382cd22)), closes [#1755](https://github.com/formatjs/formatjs/issues/1755)
-
-
-
-
-
-## [5.1.6](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.1.5...intl-messageformat-parser@5.1.6) (2020-06-23)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.1.5](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.1.4...intl-messageformat-parser@5.1.5) (2020-06-23)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.1.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.1.3...intl-messageformat-parser@5.1.4) (2020-06-20)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.1.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.1.2...intl-messageformat-parser@5.1.3) (2020-06-06)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.1.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.1.1...intl-messageformat-parser@5.1.2) (2020-06-06)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.1.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.1.0...intl-messageformat-parser@5.1.1) (2020-06-04)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-# [5.1.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.0.12...intl-messageformat-parser@5.1.0) (2020-06-04)
-
-
-### Features
-
-* **intl-messageformat-parser:** Add 'ignoreTag' option ([#1699](https://github.com/formatjs/formatjs/issues/1699)) ([5000bdf](https://github.com/formatjs/formatjs/commit/5000bdf14413857a37f3f6e1b4bb440d85ec931e))
-
-
-
-
-
-## [5.0.12](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.0.11...intl-messageformat-parser@5.0.12) (2020-06-03)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.0.11](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.0.10...intl-messageformat-parser@5.0.11) (2020-05-28)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.0.10](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.0.9...intl-messageformat-parser@5.0.10) (2020-05-27)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.0.9](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.0.8...intl-messageformat-parser@5.0.9) (2020-05-25)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.0.8](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.0.7...intl-messageformat-parser@5.0.8) (2020-05-23)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.0.7](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.0.6...intl-messageformat-parser@5.0.7) (2020-05-23)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.0.6](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.0.5...intl-messageformat-parser@5.0.6) (2020-05-21)
-
-
-### Bug Fixes
-
-* **intl-messageformat:** fix rendering tag inside plural, fix [#1680](https://github.com/formatjs/formatjs/issues/1680) ([dd4f6c6](https://github.com/formatjs/formatjs/commit/dd4f6c626055688b8b596b164f0836e9ea65fb1e))
-
-
-
-
-
-## [5.0.5](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.0.4...intl-messageformat-parser@5.0.5) (2020-05-21)
-
-
-### Bug Fixes
-
-* **@formatjs/intl-numberformat:** rename intl-unified-numberformat to intl-numberformat ([8f183d3](https://github.com/formatjs/formatjs/commit/8f183d314756d43b1f887af03727af349f6de731))
-
-
-
-
-
-## [5.0.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.0.3...intl-messageformat-parser@5.0.4) (2020-05-16)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.0.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.0.2...intl-messageformat-parser@5.0.3) (2020-05-05)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## 5.0.2 (2020-04-28)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [5.0.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@5.0.0...intl-messageformat-parser@5.0.1) (2020-04-24)
-
-
-### Bug Fixes
-
-* **eslint-plugin-formatjs:** add missing dep ([776390e](https://github.com/formatjs/formatjs/commit/776390e9d6cb3bc1eef07b2e92057136cfe95b76))
-
-
-
-
-
-# [5.0.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@4.1.4...intl-messageformat-parser@5.0.0) (2020-04-20)
-
-
-### Features
-
-* **intl-messageformat-parser:** Fix number skeleton parser ([c052050](https://github.com/formatjs/formatjs/commit/c052050403ce3697790f9983b4756b354349f982))
-
-
-### BREAKING CHANGES
-
-* **intl-messageformat-parser:** Change precision wildcard token from `+` to `*` to conform with ICU67+
-
-
-
-
-
-## [4.1.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@4.1.3...intl-messageformat-parser@4.1.4) (2020-04-14)
-
-
-### Bug Fixes
-
-* clean up tsbuildinfo before full build ([c301ca0](https://github.com/formatjs/formatjs/commit/c301ca02e0c319a0eb03921533053f0334ae5df1))
-
-
-
-
-
-## [4.1.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@4.1.2...intl-messageformat-parser@4.1.3) (2020-04-12)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [4.1.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@4.1.1...intl-messageformat-parser@4.1.2) (2020-03-30)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [4.1.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@4.1.0...intl-messageformat-parser@4.1.1) (2020-03-18)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-# [4.1.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@4.0.0...intl-messageformat-parser@4.1.0) (2020-03-05)
-
-
-### Features
-
-* **intl-messageformat-parser:** Allow - in embedded HTML tag ([43aa6a7](https://github.com/formatjs/formatjs/commit/43aa6a727ab6fd5eb3fb4d8c4035039a2c27b6c5)), closes [#545](https://github.com/formatjs/formatjs/issues/545)
-
-
-
-
-
-# [4.0.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.6.3...intl-messageformat-parser@4.0.0) (2020-03-04)
-
-
-### Features
-
-* **intl-messageformat:** combine formatHTMLMessage into format ([d59fbf1](https://github.com/formatjs/formatjs/commit/d59fbf1a4a017a3a023254cb9947575eef9cf803))
-* **intl-messageformat-parser:** Add native support for parsing XML tag ([51c49fa](https://github.com/formatjs/formatjs/commit/51c49faa46880ae6e005125c59fa23b59f0e7083))
-
-
-### BREAKING CHANGES
-
-* **intl-messageformat:** We've modified the way we parse and format embedded
-XML/HTML as follow:
-
-1. `formatHTMLMessage` has been combined with `format`
-2. All tags specified must have corresponding values and will throw
-error if it's missing, e.g: `new IntlMessageFormat("a
-strong").format({ b: (...chunks) => chunks })`
-3. Self-closing tags are treated as string literal by default. We don't
-allow formatting self-closing tags because we already use ICU
-`{placeholder}` syntax for that.
-4. XML/HTML tags are escaped using apostrophe just like other ICU
-constructs.
-5. Remove dependency on DOMParser and restrictions on void element like
-``. This effectively means you don't need to polyfill DOMParser in
-Node anymore
-
-fix(intl-messageformat-parser): fix escaping for XML tag
-* **intl-messageformat-parser:** This changes the AST and causes potential conflicts
-with previous parser version
-fix(eslint-plugin-formatjs): Adapt to new parser
-chore(babel-plugin-react-intl): update package lock
-
-
-
-
-
-## [3.6.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.6.3...intl-messageformat-parser@3.6.4) (2020-01-27)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [3.6.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.6.2...intl-messageformat-parser@3.6.3) (2020-01-22)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** fix type definition for skeleton… ([#456](https://github.com/formatjs/formatjs/issues/456)) ([c208d01](https://github.com/formatjs/formatjs/commit/c208d013558789d0030782cb817562b712ed438e))
-* **intl-messageformat-parser:** skip whitespaces that match unicode White_Space ([#468](https://github.com/formatjs/formatjs/issues/468)) ([d0dda6e](https://github.com/formatjs/formatjs/commit/d0dda6ebb40c58bf1fcaeea054d0a07db167d7b8)), closes [#467](https://github.com/formatjs/formatjs/issues/467)
-
-
-
-
-
-## [3.6.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.6.1...intl-messageformat-parser@3.6.2) (2020-01-09)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [3.6.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.6.0...intl-messageformat-parser@3.6.1) (2020-01-08)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-# [3.6.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.5.3...intl-messageformat-parser@3.6.0) (2020-01-06)
-
-
-### Features
-
-* **intl-messageformat-parser:** allow unclosed apostrophe escape sequence ([54b442f](https://github.com/formatjs/formatjs/commit/54b442f8851bd6c7cbc57e2666df294f1c799bd4))
-* **intl-messageformat-parser:** pound symbol escaping ([19fd028](https://github.com/formatjs/formatjs/commit/19fd028030356deba7b409af3c88ab24017556fc))
-
-
-
-
-
-## [3.5.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.5.2...intl-messageformat-parser@3.5.3) (2019-12-27)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [3.5.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.5.1...intl-messageformat-parser@3.5.2) (2019-12-26)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [3.5.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.5.0...intl-messageformat-parser@3.5.1) (2019-12-04)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** specify intl-unified-numberformat as dependency ([#351](https://github.com/formatjs/formatjs/issues/351)) ([e886b61](https://github.com/formatjs/formatjs/commit/e886b61f8c0eccb06eb4c168f2a01b4e6b41a23a))
-
-
-
-
-
-# [3.5.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.4.0...intl-messageformat-parser@3.5.0) (2019-12-02)
-
-
-### Features
-
-* **intl-messageformat-parser:** add support for unit-width ([dc4a054](https://github.com/formatjs/formatjs/commit/dc4a0547115e59198439579aadc3180b6953664d))
-
-
-
-
-
-# [3.4.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.3.1...intl-messageformat-parser@3.4.0) (2019-12-01)
-
-
-### Features
-
-* **intl-messageformat-parser:** add parsing support for notation, signDisplay, currencyDisplay ([eaa0039](https://github.com/formatjs/formatjs/commit/eaa0039c90533b09b0c03aa9dc9cd8c605405dba))
-* **intl-messageformat-parser:** add preliminary support for number skeleton ([e993e43](https://github.com/formatjs/formatjs/commit/e993e4387c522fd271996da79e99d2f85fd85b5f))
-
-
-
-
-
-## [3.3.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.3.0...intl-messageformat-parser@3.3.1) (2019-11-26)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-# [3.3.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.2.6...intl-messageformat-parser@3.3.0) (2019-11-25)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** exclude some more unsupported pattern ([07ec1d1](https://github.com/formatjs/formatjs/commit/07ec1d119169879617f17c542d6992c31ec85856))
-
-
-### Features
-
-* **eslint-plugin-formatjs:** add supported-datetime-skeleton rules ([c121a9a](https://github.com/formatjs/formatjs/commit/c121a9a9a52f21fbe1fdfc70e31c0275efbd0f8d))
-* **intl-messageformat:** add limited support for date time skeleton ([07795b9](https://github.com/formatjs/formatjs/commit/07795b9e5e0116ffaf5f410c4e1c1a375f86ba8a))
-
-
-
-
-
-## [3.2.6](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.2.5...intl-messageformat-parser@3.2.6) (2019-11-25)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [3.2.5](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.2.4...intl-messageformat-parser@3.2.5) (2019-11-23)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** fix duplicate parse exports, fix [#290](https://github.com/formatjs/formatjs/issues/290) ([4e20dbd](https://github.com/formatjs/formatjs/commit/4e20dbd16f44df8c034066ba328d22be2fbc082e))
-
-
-
-
-
-## [3.2.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.2.3...intl-messageformat-parser@3.2.4) (2019-11-21)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** use api-extractor to combine d.ts ([9d55531](https://github.com/formatjs/formatjs/commit/9d5553169c0c2d6f051b2c2e2c7708129ee81809))
-
-
-
-
-
-## [3.2.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.2.2...intl-messageformat-parser@3.2.3) (2019-11-20)
-
-
-### Bug Fixes
-
-* **lint:** fix lint config and rerun ([041eb99](https://github.com/formatjs/formatjs/commit/041eb99706164048b5b8ce7079955897ce27ed70))
-
-
-
-
-
-## [3.2.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.2.1...intl-messageformat-parser@3.2.2) (2019-10-23)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [3.2.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.2.0...intl-messageformat-parser@3.2.1) (2019-10-01)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-# [3.2.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.1.1...intl-messageformat-parser@3.2.0) (2019-09-20)
-
-
-### Features
-
-* **intl-messageformat-parser:** mark the package as side-effects free ([cfc8336](https://github.com/formatjs/formatjs/commit/cfc8336))
-
-
-
-
-
-## [3.1.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.1.0...intl-messageformat-parser@3.1.1) (2019-09-13)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-# [3.1.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.0.8...intl-messageformat-parser@3.1.0) (2019-09-03)
-
-
-### Features
-
-* **intl-messageformat-parser:** add UMD dist, fixes [#171](https://github.com/formatjs/formatjs/issues/171) ([94458c3](https://github.com/formatjs/formatjs/commit/94458c3))
-
-
-
-
-
-## [3.0.8](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.0.7...intl-messageformat-parser@3.0.8) (2019-08-29)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** throw when there are duplicates in select/plural, fix [#168](https://github.com/formatjs/formatjs/issues/168) ([0c3a0e0](https://github.com/formatjs/formatjs/commit/0c3a0e0))
-
-
-
-
-
-## [3.0.7](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.0.6...intl-messageformat-parser@3.0.7) (2019-08-12)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [3.0.6](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.0.5...intl-messageformat-parser@3.0.6) (2019-08-11)
-
-
-### Bug Fixes
-
-* generate lib instead of mjs ([05e63b3](https://github.com/formatjs/formatjs/commit/05e63b3))
-
-
-
-
-
-## [3.0.5](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.0.4...intl-messageformat-parser@3.0.5) (2019-08-10)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** allow negative in plural rule, fixes [#146](https://github.com/formatjs/formatjs/issues/146) ([50c7710](https://github.com/formatjs/formatjs/commit/50c7710))
-
-
-
-
-
-## [3.0.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.0.3...intl-messageformat-parser@3.0.4) (2019-08-08)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** make date time skeleton compatib… ([#140](https://github.com/formatjs/formatjs/issues/140)) ([b6ea222](https://github.com/formatjs/formatjs/commit/b6ea222))
-
-
-
-
-
-## [3.0.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.0.2...intl-messageformat-parser@3.0.3) (2019-08-07)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** normalize plural in nested select, fixes [#145](https://github.com/formatjs/formatjs/issues/145) ([215aa6d](https://github.com/formatjs/formatjs/commit/215aa6d))
-
-
-
-
-
-## [3.0.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.0.1...intl-messageformat-parser@3.0.2) (2019-08-06)
-
-
-### Bug Fixes
-
-* generate .mjs instead of lib ([0c34ee4](https://github.com/formatjs/formatjs/commit/0c34ee4))
-
-
-
-
-
-## [3.0.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.0.0...intl-messageformat-parser@3.0.1) (2019-07-29)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** argStyleText can contain syntax characters and quoted string now ([#136](https://github.com/formatjs/formatjs/issues/136)) ([b39ea08](https://github.com/formatjs/formatjs/commit/b39ea08)), closes [#135](https://github.com/formatjs/formatjs/issues/135)
-
-
-
-
-
-# [3.0.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@2.1.3...intl-messageformat-parser@3.0.0) (2019-07-29)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** fix plural =xx grammar ([1c3c1fc](https://github.com/formatjs/formatjs/commit/1c3c1fc))
-
-
-### Features
-
-* **intl-messageformat-parser:** add parser for number skeleton and date skeleton ([#131](https://github.com/formatjs/formatjs/issues/131)) ([dbe6799](https://github.com/formatjs/formatjs/commit/dbe6799))
-* **intl-messageformat-parser:** revamped quote rule ([#134](https://github.com/formatjs/formatjs/issues/134)) ([5661177](https://github.com/formatjs/formatjs/commit/5661177))
-* **intl-messageformat-parser:** support argument skeleton for AST printers ([#133](https://github.com/formatjs/formatjs/issues/133)) ([f1f937d](https://github.com/formatjs/formatjs/commit/f1f937d))
-
-
-### BREAKING CHANGES
-
-* **intl-messageformat-parser:** This changes how we escape chars in messages, instead of `\` we now use apostrophe which is more aligned with ICU4J & ICU4C
-
-
-
-
-
-## [2.1.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@2.1.2...intl-messageformat-parser@2.1.3) (2019-07-25)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-
-
-
-
-## [2.1.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@2.1.1...intl-messageformat-parser@2.1.2) (2019-07-23)
-
-
-### Bug Fixes
-
-* **intl-messageformat-parser:** add tests, fix offset printing ([bebdf95](https://github.com/formatjs/formatjs/commit/bebdf95))
-* **intl-messageformat-parser:** Fix AST printer to print white-spaces, commas and element types… ([#120](https://github.com/formatjs/formatjs/issues/120)) ([37448e2](https://github.com/formatjs/formatjs/commit/37448e2)), closes [#117](https://github.com/formatjs/formatjs/issues/117)
-
-
-
-
-
-## [2.1.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@2.1.0...intl-messageformat-parser@2.1.1) (2019-07-12)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-# [2.1.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@2.0.1...intl-messageformat-parser@2.1.0) (2019-07-12)
-
-### Features
-
-- **intl-messageformat-parser:** add printer to print AST to string ([ec0eaa2](https://github.com/formatjs/formatjs/commit/ec0eaa2))
-
-## [2.0.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@2.0.0...intl-messageformat-parser@2.0.1) (2019-07-09)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-# [2.0.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.8.1...intl-messageformat-parser@2.0.0) (2019-07-08)
-
-### Features
-
-- **intl-messageformat-parser:** Rewrite grammar ([#112](https://github.com/formatjs/formatjs/issues/112)) ([093de35](https://github.com/formatjs/formatjs/commit/093de35))
-
-### BREAKING CHANGES
-
-- **intl-messageformat-parser:** This completely changes the AST produced by the parser
-
-Before:
-
-```
-complex_msg AST length 12567
-normal_msg AST length 2638
-simple_msg AST length 567
-string_msg AST length 288
-complex_msg x 3,405 ops/sec ±5.44% (81 runs sampled)
-normal_msg x 27,513 ops/sec ±2.14% (87 runs sampled)
-simple_msg x 113,043 ops/sec ±1.20% (89 runs sampled)
-string_msg x 147,838 ops/sec ±0.78% (90 runs sampled)
-```
-
-After:
-
-```
-complex_msg AST length 2053
-normal_msg AST length 410
-simple_msg AST length 79
-string_msg AST length 36
-complex_msg x 3,926 ops/sec ±2.37% (90 runs sampled)
-normal_msg x 27,641 ops/sec ±3.93% (86 runs sampled)
-simple_msg x 100,764 ops/sec ±5.35% (79 runs sampled)
-string_msg x 120,362 ops/sec ±7.11% (74 runs sampled)
-```
-
-- feat: normalize hashtag token in plural
-
-- feat(intl-messageformat): adapt to new AST
-
-- feat(babel-plugin-react-intl): adapt to new AST
-
-## [1.8.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.8.0...intl-messageformat-parser@1.8.1) (2019-06-28)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-# [1.8.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.7.1...intl-messageformat-parser@1.8.0) (2019-06-27)
-
-### Features
-
-- **intl-messageformat:** allow passing in formatters ([#107](https://github.com/formatjs/formatjs/issues/107)) ([3605693](https://github.com/formatjs/formatjs/commit/3605693))
-
-## [1.7.1](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.7.0...intl-messageformat-parser@1.7.1) (2019-06-26)
-
-### Bug Fixes
-
-- **intl-messageformat-parser:** Escape double-' to a single ' ([#103](https://github.com/formatjs/formatjs/issues/103)) ([4d0cd1f](https://github.com/formatjs/formatjs/commit/4d0cd1f))
-
-# [1.7.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.8...intl-messageformat-parser@1.7.0) (2019-06-27)
-
-### Features
-
-- **intl-utils:** Add intl-utils ([#98](https://github.com/formatjs/formatjs/issues/98)) ([2329c57](https://github.com/formatjs/formatjs/commit/2329c57))
-
-## [1.6.8](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.7...intl-messageformat-parser@1.6.8) (2019-06-18)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-## [1.6.7](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.6...intl-messageformat-parser@1.6.7) (2019-06-18)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-## [1.6.6](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.5...intl-messageformat-parser@1.6.6) (2019-06-12)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-## [1.6.5](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.3...intl-messageformat-parser@1.6.5) (2019-06-03)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-## [1.6.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.3...intl-messageformat-parser@1.6.4) (2019-06-03)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-## [1.6.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.2...intl-messageformat-parser@1.6.3) (2019-05-28)
-
-**Note:** Version bump only for package intl-messageformat-parser
-
-## [1.6.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.2...intl-messageformat-parser@1.6.2) (2019-05-28)
diff --git a/packages/intl-messageformat-parser/LICENSE.md b/packages/intl-messageformat-parser/LICENSE.md
deleted file mode 100644
index e85b09466b..0000000000
--- a/packages/intl-messageformat-parser/LICENSE.md
+++ /dev/null
@@ -1,33 +0,0 @@
-Copyright (c) 2019, Oath Inc.
-
-Licensed under the terms of the New BSD license. See below for terms.
-
-Redistribution and use of this software in source and binary forms,
-with or without modification, are permitted provided that the following
-conditions are met:
-
-- Redistributions of source code must retain the above
- copyright notice, this list of conditions and the
- following disclaimer.
-
-- Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the
- following disclaimer in the documentation and/or other
- materials provided with the distribution.
-
-- Neither the name of Oath Inc. nor the names of its
- contributors may be used to endorse or promote products
- derived from this software without specific prior
- written permission of Oath Inc.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/packages/intl-messageformat-parser/README.md b/packages/intl-messageformat-parser/README.md
deleted file mode 100644
index 968a5c6568..0000000000
--- a/packages/intl-messageformat-parser/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Intl MessageFormat Parser
-
-We've migrated the docs to https://formatjs.io/docs/intl-messageformat-parser.
diff --git a/packages/intl-messageformat-parser/index.ts b/packages/intl-messageformat-parser/index.ts
deleted file mode 100644
index a01538c25f..0000000000
--- a/packages/intl-messageformat-parser/index.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import {pegParse, IParseOptions} from './src/parser'
-import {Options, MessageFormatElement} from './src/types'
-import {normalizeHashtagInPlural} from './src/normalize'
-export * from './src/types'
-export * from './src/parser'
-
-export type ParseOptions = Options & IParseOptions
-
-export function parse(
- input: string,
- opts?: ParseOptions
-): MessageFormatElement[] {
- opts = {
- normalizeHashtagInPlural: true,
- shouldParseSkeleton: true,
- ...(opts || {}),
- }
- const els = pegParse(input, opts)
- if (opts.normalizeHashtagInPlural) {
- normalizeHashtagInPlural(els)
- }
- return els
-}
diff --git a/packages/intl-messageformat-parser/no-parser.ts b/packages/intl-messageformat-parser/no-parser.ts
deleted file mode 100644
index 247ccbe19f..0000000000
--- a/packages/intl-messageformat-parser/no-parser.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import {IParseOptions} from './src/parser'
-import {Options} from './src/types'
-export * from './src/types'
-
-export type ParseOptions = Options & IParseOptions
-
-export function parse() {
- throw new Error(
- "You're trying to format an uncompiled message with react-intl without parser, please import from 'react-int' instead"
- )
-}
diff --git a/packages/intl-messageformat-parser/package.json b/packages/intl-messageformat-parser/package.json
deleted file mode 100644
index 369f078fcc..0000000000
--- a/packages/intl-messageformat-parser/package.json
+++ /dev/null
@@ -1,43 +0,0 @@
-{
- "name": "intl-messageformat-parser",
- "version": "6.4.4",
- "description": "Parses ICU Message strings into an AST via JavaScript.",
- "main": "index.js",
- "module": "lib/index.js",
- "types": "index.d.ts",
- "contributors": [
- "Eric Ferraiuolo ",
- "Long Ho ",
- "Ryuichi Okumura ",
- "Seth Bertalotto ",
- "Song Seunggeun ",
- "Tobias Bieniek "
- ],
- "repository": {
- "type": "git",
- "url": "git://github.com/formatjs/formatjs.git"
- },
- "keywords": [
- "i18n",
- "intl",
- "internationalization",
- "localization",
- "globalization",
- "messageformat",
- "parser",
- "plural",
- "icu"
- ],
- "sideEffects": false,
- "author": "Eric Ferraiuolo ",
- "license": "BSD-3-Clause",
- "bugs": {
- "url": "https://github.com/formatjs/formatjs/issues"
- },
- "dependencies": {
- "@formatjs/ecma402-abstract": "1.6.4",
- "tslib": "^2.1.0"
- },
- "homepage": "https://github.com/formatjs/formatjs",
- "gitHead": "8b0baec8eda5002715cf893274fe59782fc2d371"
-}
diff --git a/packages/intl-messageformat-parser/src/normalize.ts b/packages/intl-messageformat-parser/src/normalize.ts
deleted file mode 100644
index 30e0373413..0000000000
--- a/packages/intl-messageformat-parser/src/normalize.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-import {
- MessageFormatElement,
- isPluralElement,
- isLiteralElement,
- LiteralElement,
- isSelectElement,
-} from './types'
-import {pegParse} from './parser'
-
-const PLURAL_HASHTAG_REGEX = /(^|[^\\])#/g
-
-/**
- * Whether to convert `#` in plural rule options
- * to `{var, number}`
- * @param el AST Element
- * @param pluralStack current plural stack
- */
-export function normalizeHashtagInPlural(els: MessageFormatElement[]): void {
- els.forEach(el => {
- // If we're encountering a plural el
- if (!isPluralElement(el) && !isSelectElement(el)) {
- return
- }
- // Go down the options and search for # in any literal element
- Object.keys(el.options).forEach(id => {
- const opt = el.options[id]
- // If we got a match, we have to split this
- // and inject a NumberElement in the middle
- let matchingLiteralElIndex = -1
- let literalEl: LiteralElement | undefined = undefined
- for (let i = 0; i < opt.value.length; i++) {
- const el = opt.value[i] as LiteralElement
- if (isLiteralElement(el) && PLURAL_HASHTAG_REGEX.test(el.value)) {
- matchingLiteralElIndex = i
- literalEl = el
- break
- }
- }
-
- if (literalEl) {
- const newValue = literalEl.value.replace(
- PLURAL_HASHTAG_REGEX,
- `$1{${el.value}, number}`
- )
- const newEls = pegParse(newValue)
- opt.value.splice(matchingLiteralElIndex, 1, ...newEls)
- }
- normalizeHashtagInPlural(opt.value)
- })
- })
-}
diff --git a/packages/intl-messageformat-parser/src/parser.pegjs b/packages/intl-messageformat-parser/src/parser.pegjs
deleted file mode 100644
index 1e6d4bca8e..0000000000
--- a/packages/intl-messageformat-parser/src/parser.pegjs
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
-Copyright 2014, Yahoo! Inc. All rights reserved.
-Copyrights licensed under the New BSD License.
-See the accompanying LICENSE file for terms.
-*/
-
-/*
- * IMPORTANT: `TYPE` comes from `types.ts`
- * `parseNumberSkeleton` & `parseDateTimeSkeleton` from 'skeleton.ts`
- */
-
-{
- const messageCtx = ['root'];
-
- function isNestedMessageText() {
- return messageCtx.length > 1;
- }
-
- function isInPluralOption() {
- return messageCtx[messageCtx.length - 1] === 'plural';
- }
-
- function insertLocation() {
- return options && options.captureLocation ? {
- location: location()
- }: {}
- }
-
- const ignoreTag = options && options.ignoreTag;
- const shouldParseSkeleton = options && options.shouldParseSkeleton;
-}
-
-start
- = message
-
-message = messageElement*
-
-messageElement
- = &{ return !ignoreTag; } x:tagElement { return x; }
- / literalElement
- / argumentElement
- / simpleFormatElement
- / pluralElement
- / selectElement
- / poundElement
-
-messageText
- = &{ return ignoreTag; } parts:(doubleApostrophes / quotedString / unquotedString / '<')+ {
- return parts.join('');
- }
- / parts:(doubleApostrophes / quotedString / unquotedString / nonTagStartingAngleBracket)+ {
- return parts.join('');
- }
-
-// This is the case when ignoreTag is false.
-nonTagStartingAngleBracket = !(openingTag / closingTag / selfClosingTag) '<' { return '<'; }
-
-literalElement
- = messageText:messageText {
- return {
- type : TYPE.literal,
- value: messageText,
- ...insertLocation()
- };
- }
-
-poundElement = '#' {
- return {
- type: TYPE.pound,
- ...insertLocation()
- };
-}
-
-tagElement 'tagElement'
- = selfClosingTag
- / open:openingTag children:message close:closingTag {
- if (open !== close) {
- error(`Mismatch tag "${open}" !== "${close}"`, location())
- }
- return {
- type: TYPE.tag,
- value: open,
- children,
- ...insertLocation()
- }
- }
-
-// Special case for self-closing. We treat it as regular text
-selfClosingTag = value:('<' validTag _ '/>') {
- return {
- type: TYPE.literal,
- value: value.join(''),
- ...insertLocation()
- }
-}
-openingTag = '<' tag:validTag '>' { return tag; }
-closingTag = '' tag:validTag '>' { return tag; }
-
-argumentElement 'argumentElement'
- = '{' _ value:argNameOrNumber _ '}' {
- return {
- type: TYPE.argument,
- value,
- ...insertLocation()
- }
- }
-
-numberSkeletonId 'numberSkeletonId'
- = $(!(whiteSpace / [\'\/{}]) .)+
-
-numberSkeletonTokenOption 'numberSkeletonTokenOption'
- = '/' option:numberSkeletonId { return option; }
-
-numberSkeletonToken 'numberSkeletonToken'
- = _ stem:numberSkeletonId options:(numberSkeletonTokenOption*) {
- return {stem: stem, options};
- }
-
-// See also:
-// https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md
-numberSkeleton
- = tokens:(numberSkeletonToken+) {
- return {
- type: SKELETON_TYPE.number,
- tokens,
- parsedOptions: shouldParseSkeleton ? parseNumberSkeleton(tokens) : {},
- ...insertLocation()
- }
- }
-
-numberArgStyle
- = '::' skeleton:numberSkeleton { return skeleton; }
- / &{ messageCtx.push('numberArgStyle'); return true; } style:messageText {
- messageCtx.pop();
- return style.replace(/\s*$/, '');
- }
-
-numberFormatElement
- = '{' _ value:argNameOrNumber _ ',' _ type:'number' _ style:(',' _ numberArgStyle)? _ '}' {
- return {
- type : type === 'number' ? TYPE.number : type === 'date' ? TYPE.date : TYPE.time,
- style : style && style[2],
- value,
- ...insertLocation()
- };
- }
-
-dateTimeSkeletonLiteral = "'" (doubleApostrophes / [^'])+ "'" / (doubleApostrophes / [^a-zA-Z'{}])+
-dateTimeSkeletonPattern = [a-zA-Z]+
-
-// See also:
-// - http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
-// - http://cldr.unicode.org/translation/date-time-1/date-time-patterns
-dateTimeSkeleton
- = pattern:$(dateTimeSkeletonLiteral / dateTimeSkeletonPattern)+ {
- return {
- type: SKELETON_TYPE.dateTime,
- pattern,
- parsedOptions: shouldParseSkeleton ? parseDateTimeSkeleton(pattern) : {},
- ...insertLocation(),
- }
- }
-
-dateOrTimeArgStyle
- = '::' skeleton:dateTimeSkeleton { return skeleton; }
- / &{ messageCtx.push('dateOrTimeArgStyle'); return true; } style:messageText {
- messageCtx.pop();
- return style.replace(/\s*$/, '');
- }
-
-dateOrTimeFormatElement
- = '{' _ value:argNameOrNumber _ ',' _ type:('date' / 'time') _ style:(',' _ dateOrTimeArgStyle)? _ '}' {
- return {
- type : type === 'number' ? TYPE.number : type === 'date' ? TYPE.date : TYPE.time,
- style : style && style[2],
- value,
- ...insertLocation()
- };
- }
-
-simpleFormatElement
- = numberFormatElement / dateOrTimeFormatElement
-
-pluralElement
- = '{' _ value:argNameOrNumber _ ',' _ pluralType:('plural' / 'selectordinal') _ ',' _ offset:('offset:' _ number)? _ options:pluralOption+ _ '}' {
- return {
- type : TYPE.plural,
- pluralType: pluralType === 'plural' ? 'cardinal' : 'ordinal',
- value,
- offset : offset ? offset[2] : 0,
- options: options.reduce((all, {id, value, location: optionLocation}) => {
- if (id in all) {
- error(`Duplicate option "${id}" in plural element: "${text()}"`, location())
- }
- all[id] = {
- value,
- location: optionLocation
- }
- return all
- }, {}),
- ...insertLocation()
- };
- }
-
-selectElement
- = '{' _ value:argNameOrNumber _ ',' _ 'select' _ ',' _ options:selectOption+ _ '}' {
- return {
- type : TYPE.select,
- value,
- options: options.reduce((all, {id, value, location: optionLocation}) => {
- if (id in all) {
- error(`Duplicate option "${id}" in select element: "${text()}"`, location())
- }
- all[id] = {
- value,
- location: optionLocation
- }
- return all
- }, {}),
- ...insertLocation()
- };
- }
-
-pluralRuleSelectValue
- = $('=' number)
- / argName
-
-selectOption
- = _ id:argName _ '{' &{ messageCtx.push('select'); return true; } value:message '}' {
- messageCtx.pop();
- return {
- id,
- value,
- ...insertLocation()
- }
- }
-
-pluralOption
- = _ id:pluralRuleSelectValue _ '{' &{ messageCtx.push('plural'); return true; } value:message '}' {
- messageCtx.pop();
- return {
- id,
- value,
- ...insertLocation()
- };
- }
-
-// -- Helpers ------------------------------------------------------------------
-
-// Equivalence of \p{White_Space}
-// See: https://github.com/mathiasbynens/unicode-12.1.0/blob/master/Binary_Property/White_Space/regex.js
-whiteSpace 'whitespace' = [\t-\r \x85\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]
-// Equivalence of \p{Pattern_Syntax}
-// See: https://github.com/mathiasbynens/unicode-11.0.0/blob/master/Binary_Property/Pattern_Syntax/regex.js
-patternSyntax 'syntax pattern' = [!-\/:-@\[-\^`\{-~\xA1-\xA7\xA9\xAB\xAC\xAE\xB0\xB1\xB6\xBB\xBF\xD7\xF7\u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E\u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F\u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46]
-
-_ 'optional whitespace' = $(whiteSpace*)
-
-number 'number' = negative:'-'? num:argNumber {
- return num
- ? negative
- ? -num
- : num
- : 0
-}
-
-apostrophe 'apostrophe' = "'"
-doubleApostrophes 'double apostrophes' = "''" { return `'`; }
-
-// Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes
-// a character that requires quoting (that is, "only where needed"), and works the same in
-// nested messages as on the top level of the pattern. The new behavior is otherwise compatible.
-quotedString = "'" escapedChar:escapedChar quotedChars:$("''" / [^'])* "'"? {
- return escapedChar + quotedChars.replace(`''`, `'`);
-}
-
-unquotedString = $(x:. &{
- return (
- x !== '<' &&
- x !== '{' &&
- !(isInPluralOption() && x === '#') &&
- !(isNestedMessageText() && x === '}')
- );
-} / '\n')
-
-escapedChar = $(x:. &{
- return x === '<' || x === '>' || x === '{' || x === '}' || (isInPluralOption() && x === '#');
-})
-
-argNameOrNumber 'argNameOrNumber' = $(argNumber / argName)
-validTag 'validTag' = $(argNumber / tagName)
-argNumber 'argNumber' = '0' { return 0 }
- / digits:([1-9][0-9]*) {
- return parseInt(digits.join(''), 10);
- }
-argName 'argName' = $((!(whiteSpace / patternSyntax).)+)
-tagName 'tagName' = $(('-' / (!(whiteSpace / patternSyntax).))+)
diff --git a/packages/intl-messageformat-parser/src/parser.ts b/packages/intl-messageformat-parser/src/parser.ts
deleted file mode 100644
index 242b4fa15b..0000000000
--- a/packages/intl-messageformat-parser/src/parser.ts
+++ /dev/null
@@ -1,2988 +0,0 @@
-// @ts-nocheck
-
-// @generated
-import {
- ArgumentElement,
- DateElement,
- DateTimeSkeleton,
- LiteralElement,
- MessageFormatElement,
- NumberElement,
- NumberSkeleton,
- PluralElement,
- PluralOrSelectOption,
- PoundElement,
- SelectElement,
- SKELETON_TYPE,
- TagElement,
- TimeElement,
- TYPE,
-} from './types'
-import {parseDateTimeSkeleton, parseNumberSkeleton} from './skeleton'
-
-// Generated by PEG.js v. 0.10.0 (ts-pegjs plugin v. 0.3.1 )
-//
-// https://pegjs.org/ https://github.com/metadevpro/ts-pegjs
-
-export interface IFilePosition {
- offset: number;
- line: number;
- column: number;
-}
-
-export interface IFileRange {
- start: IFilePosition;
- end: IFilePosition;
-}
-
-export interface ILiteralExpectation {
- type: "literal";
- text: string;
- ignoreCase: boolean;
-}
-
-export interface IClassParts extends Array {}
-
-export interface IClassExpectation {
- type: "class";
- parts: IClassParts;
- inverted: boolean;
- ignoreCase: boolean;
-}
-
-export interface IAnyExpectation {
- type: "any";
-}
-
-export interface IEndExpectation {
- type: "end";
-}
-
-export interface IOtherExpectation {
- type: "other";
- description: string;
-}
-
-export type Expectation = ILiteralExpectation | IClassExpectation | IAnyExpectation | IEndExpectation | IOtherExpectation;
-
-export class SyntaxError extends Error {
- public static buildMessage(expected: Expectation[], found: string | null) {
- function hex(ch: string): string {
- return ch.charCodeAt(0).toString(16).toUpperCase();
- }
-
- function literalEscape(s: string): string {
- return s
- .replace(/\\/g, "\\\\")
- .replace(/"/g, "\\\"")
- .replace(/\0/g, "\\0")
- .replace(/\t/g, "\\t")
- .replace(/\n/g, "\\n")
- .replace(/\r/g, "\\r")
- .replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex(ch) )
- .replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex(ch) );
- }
-
- function classEscape(s: string): string {
- return s
- .replace(/\\/g, "\\\\")
- .replace(/\]/g, "\\]")
- .replace(/\^/g, "\\^")
- .replace(/-/g, "\\-")
- .replace(/\0/g, "\\0")
- .replace(/\t/g, "\\t")
- .replace(/\n/g, "\\n")
- .replace(/\r/g, "\\r")
- .replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex(ch) )
- .replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex(ch) );
- }
-
- function describeExpectation(expectation: Expectation) {
- switch (expectation.type) {
- case "literal":
- return "\"" + literalEscape(expectation.text) + "\"";
- case "class":
- const escapedParts = expectation.parts.map((part) => {
- return Array.isArray(part)
- ? classEscape(part[0] as string) + "-" + classEscape(part[1] as string)
- : classEscape(part);
- });
-
- return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
- case "any":
- return "any character";
- case "end":
- return "end of input";
- case "other":
- return expectation.description;
- }
- }
-
- function describeExpected(expected1: Expectation[]) {
- const descriptions = expected1.map(describeExpectation);
- let i: number;
- let j: number;
-
- descriptions.sort();
-
- if (descriptions.length > 0) {
- for (i = 1, j = 1; i < descriptions.length; i++) {
- if (descriptions[i - 1] !== descriptions[i]) {
- descriptions[j] = descriptions[i];
- j++;
- }
- }
- descriptions.length = j;
- }
-
- switch (descriptions.length) {
- case 1:
- return descriptions[0];
-
- case 2:
- return descriptions[0] + " or " + descriptions[1];
-
- default:
- return descriptions.slice(0, -1).join(", ")
- + ", or "
- + descriptions[descriptions.length - 1];
- }
- }
-
- function describeFound(found1: string | null) {
- return found1 ? "\"" + literalEscape(found1) + "\"" : "end of input";
- }
-
- return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
- }
-
- public message: string;
- public expected: Expectation[];
- public found: string | null;
- public location: IFileRange;
- public name: string;
-
- constructor(message: string, expected: Expectation[], found: string | null, location: IFileRange) {
- super();
- this.message = message;
- this.expected = expected;
- this.found = found;
- this.location = location;
- this.name = "SyntaxError";
-
- if (typeof (Error as any).captureStackTrace === "function") {
- (Error as any).captureStackTrace(this, SyntaxError);
- }
- }
-}
-
-function peg$parse(input: string, options?: IParseOptions) {
- options = options !== undefined ? options : {};
-
- const peg$FAILED: Readonly = {};
-
- const peg$startRuleFunctions: {[id: string]: any} = { start: peg$parsestart };
- let peg$startRuleFunction: () => any = peg$parsestart;
-
- const peg$c0 = function(): any { return !ignoreTag; };
- const peg$c1 = function(x: any): any { return x; };
- const peg$c2 = function(): any { return ignoreTag; };
- const peg$c3 = "<";
- const peg$c4 = peg$literalExpectation("<", false);
- const peg$c5 = function(parts: any): any {
- return parts.join('');
- };
- const peg$c6 = function(): any { return '<'; };
- const peg$c7 = function(messageText: any): any {
- return {
- type : TYPE.literal,
- value: messageText,
- ...insertLocation()
- };
- };
- const peg$c8 = "#";
- const peg$c9 = peg$literalExpectation("#", false);
- const peg$c10 = function(): any {
- return {
- type: TYPE.pound,
- ...insertLocation()
- };
- };
- const peg$c11 = peg$otherExpectation("tagElement");
- const peg$c12 = function(open: any, children: any, close: any): any {
- if (open !== close) {
- error(`Mismatch tag "${open}" !== "${close}"`, location())
- }
- return {
- type: TYPE.tag,
- value: open,
- children,
- ...insertLocation()
- }
- };
- const peg$c13 = "/>";
- const peg$c14 = peg$literalExpectation("/>", false);
- const peg$c15 = function(value: any): any {
- return {
- type: TYPE.literal,
- value: value.join(''),
- ...insertLocation()
- }
- };
- const peg$c16 = ">";
- const peg$c17 = peg$literalExpectation(">", false);
- const peg$c18 = function(tag: any): any { return tag; };
- const peg$c19 = "";
- const peg$c20 = peg$literalExpectation("", false);
- const peg$c21 = peg$otherExpectation("argumentElement");
- const peg$c22 = "{";
- const peg$c23 = peg$literalExpectation("{", false);
- const peg$c24 = "}";
- const peg$c25 = peg$literalExpectation("}", false);
- const peg$c26 = function(value: any): any {
- return {
- type: TYPE.argument,
- value,
- ...insertLocation()
- }
- };
- const peg$c27 = peg$otherExpectation("numberSkeletonId");
- const peg$c28 = /^['\/{}]/;
- const peg$c29 = peg$classExpectation(["'", "/", "{", "}"], false, false);
- const peg$c30 = peg$anyExpectation();
- const peg$c31 = peg$otherExpectation("numberSkeletonTokenOption");
- const peg$c32 = "/";
- const peg$c33 = peg$literalExpectation("/", false);
- const peg$c34 = function(option: any): any { return option; };
- const peg$c35 = peg$otherExpectation("numberSkeletonToken");
- const peg$c36 = function(stem: any, options: any): any {
- return {stem: stem, options};
- };
- const peg$c37 = function(tokens: any): any {
- return {
- type: SKELETON_TYPE.number,
- tokens,
- parsedOptions: shouldParseSkeleton ? parseNumberSkeleton(tokens) : {},
- ...insertLocation()
- }
- };
- const peg$c38 = "::";
- const peg$c39 = peg$literalExpectation("::", false);
- const peg$c40 = function(skeleton: any): any { return skeleton; };
- const peg$c41 = function(): any { messageCtx.push('numberArgStyle'); return true; };
- const peg$c42 = function(style: any): any {
- messageCtx.pop();
- return style.replace(/\s*$/, '');
- };
- const peg$c43 = ",";
- const peg$c44 = peg$literalExpectation(",", false);
- const peg$c45 = "number";
- const peg$c46 = peg$literalExpectation("number", false);
- const peg$c47 = function(value: any, type: any, style: any): any {
- return {
- type : type === 'number' ? TYPE.number : type === 'date' ? TYPE.date : TYPE.time,
- style : style && style[2],
- value,
- ...insertLocation()
- };
- };
- const peg$c48 = "'";
- const peg$c49 = peg$literalExpectation("'", false);
- const peg$c50 = /^[^']/;
- const peg$c51 = peg$classExpectation(["'"], true, false);
- const peg$c52 = /^[^a-zA-Z'{}]/;
- const peg$c53 = peg$classExpectation([["a", "z"], ["A", "Z"], "'", "{", "}"], true, false);
- const peg$c54 = /^[a-zA-Z]/;
- const peg$c55 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false);
- const peg$c56 = function(pattern: any): any {
- return {
- type: SKELETON_TYPE.dateTime,
- pattern,
- parsedOptions: shouldParseSkeleton ? parseDateTimeSkeleton(pattern) : {},
- ...insertLocation(),
- }
- };
- const peg$c57 = function(): any { messageCtx.push('dateOrTimeArgStyle'); return true; };
- const peg$c58 = "date";
- const peg$c59 = peg$literalExpectation("date", false);
- const peg$c60 = "time";
- const peg$c61 = peg$literalExpectation("time", false);
- const peg$c62 = "plural";
- const peg$c63 = peg$literalExpectation("plural", false);
- const peg$c64 = "selectordinal";
- const peg$c65 = peg$literalExpectation("selectordinal", false);
- const peg$c66 = "offset:";
- const peg$c67 = peg$literalExpectation("offset:", false);
- const peg$c68 = function(value: any, pluralType: any, offset: any, options: any): any {
- return {
- type : TYPE.plural,
- pluralType: pluralType === 'plural' ? 'cardinal' : 'ordinal',
- value,
- offset : offset ? offset[2] : 0,
- options: options.reduce((all, {id, value, location: optionLocation}) => {
- if (id in all) {
- error(`Duplicate option "${id}" in plural element: "${text()}"`, location())
- }
- all[id] = {
- value,
- location: optionLocation
- }
- return all
- }, {}),
- ...insertLocation()
- };
- };
- const peg$c69 = "select";
- const peg$c70 = peg$literalExpectation("select", false);
- const peg$c71 = function(value: any, options: any): any {
- return {
- type : TYPE.select,
- value,
- options: options.reduce((all, {id, value, location: optionLocation}) => {
- if (id in all) {
- error(`Duplicate option "${id}" in select element: "${text()}"`, location())
- }
- all[id] = {
- value,
- location: optionLocation
- }
- return all
- }, {}),
- ...insertLocation()
- };
- };
- const peg$c72 = "=";
- const peg$c73 = peg$literalExpectation("=", false);
- const peg$c74 = function(id: any): any { messageCtx.push('select'); return true; };
- const peg$c75 = function(id: any, value: any): any {
- messageCtx.pop();
- return {
- id,
- value,
- ...insertLocation()
- }
- };
- const peg$c76 = function(id: any): any { messageCtx.push('plural'); return true; };
- const peg$c77 = function(id: any, value: any): any {
- messageCtx.pop();
- return {
- id,
- value,
- ...insertLocation()
- };
- };
- const peg$c78 = peg$otherExpectation("whitespace");
- const peg$c79 = /^[\t-\r \x85\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;
- const peg$c80 = peg$classExpectation([["\t", "\r"], " ", "\x85", "\xA0", "\u1680", ["\u2000", "\u200A"], "\u2028", "\u2029", "\u202F", "\u205F", "\u3000"], false, false);
- const peg$c81 = peg$otherExpectation("syntax pattern");
- const peg$c82 = /^[!-\/:-@[-\^`{-~\xA1-\xA7\xA9\xAB\xAC\xAE\xB0\xB1\xB6\xBB\xBF\xD7\xF7\u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E\u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F\u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46]/;
- const peg$c83 = peg$classExpectation([["!", "/"], [":", "@"], ["[", "^"], "`", ["{", "~"], ["\xA1", "\xA7"], "\xA9", "\xAB", "\xAC", "\xAE", "\xB0", "\xB1", "\xB6", "\xBB", "\xBF", "\xD7", "\xF7", ["\u2010", "\u2027"], ["\u2030", "\u203E"], ["\u2041", "\u2053"], ["\u2055", "\u205E"], ["\u2190", "\u245F"], ["\u2500", "\u2775"], ["\u2794", "\u2BFF"], ["\u2E00", "\u2E7F"], ["\u3001", "\u3003"], ["\u3008", "\u3020"], "\u3030", "\uFD3E", "\uFD3F", "\uFE45", "\uFE46"], false, false);
- const peg$c84 = peg$otherExpectation("optional whitespace");
- const peg$c85 = peg$otherExpectation("number");
- const peg$c86 = "-";
- const peg$c87 = peg$literalExpectation("-", false);
- const peg$c88 = function(negative: any, num: any): any {
- return num
- ? negative
- ? -num
- : num
- : 0
- };
- const peg$c89 = peg$otherExpectation("apostrophe");
- const peg$c90 = peg$otherExpectation("double apostrophes");
- const peg$c91 = "''";
- const peg$c92 = peg$literalExpectation("''", false);
- const peg$c93 = function(): any { return `'`; };
- const peg$c94 = function(escapedChar: any, quotedChars: any): any {
- return escapedChar + quotedChars.replace(`''`, `'`);
- };
- const peg$c95 = function(x: any): any {
- return (
- x !== '<' &&
- x !== '{' &&
- !(isInPluralOption() && x === '#') &&
- !(isNestedMessageText() && x === '}')
- );
- };
- const peg$c96 = "\n";
- const peg$c97 = peg$literalExpectation("\n", false);
- const peg$c98 = function(x: any): any {
- return x === '<' || x === '>' || x === '{' || x === '}' || (isInPluralOption() && x === '#');
- };
- const peg$c99 = peg$otherExpectation("argNameOrNumber");
- const peg$c100 = peg$otherExpectation("validTag");
- const peg$c101 = peg$otherExpectation("argNumber");
- const peg$c102 = "0";
- const peg$c103 = peg$literalExpectation("0", false);
- const peg$c104 = function(): any { return 0 };
- const peg$c105 = /^[1-9]/;
- const peg$c106 = peg$classExpectation([["1", "9"]], false, false);
- const peg$c107 = /^[0-9]/;
- const peg$c108 = peg$classExpectation([["0", "9"]], false, false);
- const peg$c109 = function(digits: any): any {
- return parseInt(digits.join(''), 10);
- };
- const peg$c110 = peg$otherExpectation("argName");
- const peg$c111 = peg$otherExpectation("tagName");
-
- let peg$currPos = 0;
- let peg$savedPos = 0;
- const peg$posDetailsCache = [{ line: 1, column: 1 }];
- let peg$maxFailPos = 0;
- let peg$maxFailExpected: Expectation[] = [];
- let peg$silentFails = 0;
-
- let peg$result;
-
- if (options.startRule !== undefined) {
- if (!(options.startRule in peg$startRuleFunctions)) {
- throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
- }
-
- peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
- }
-
- function text(): string {
- return input.substring(peg$savedPos, peg$currPos);
- }
-
- function location(): IFileRange {
- return peg$computeLocation(peg$savedPos, peg$currPos);
- }
-
- function expected(description: string, location1?: IFileRange) {
- location1 = location1 !== undefined
- ? location1
- : peg$computeLocation(peg$savedPos, peg$currPos);
-
- throw peg$buildStructuredError(
- [peg$otherExpectation(description)],
- input.substring(peg$savedPos, peg$currPos),
- location1
- );
- }
-
- function error(message: string, location1?: IFileRange) {
- location1 = location1 !== undefined
- ? location1
- : peg$computeLocation(peg$savedPos, peg$currPos);
-
- throw peg$buildSimpleError(message, location1);
- }
-
- function peg$literalExpectation(text1: string, ignoreCase: boolean): ILiteralExpectation {
- return { type: "literal", text: text1, ignoreCase: ignoreCase };
- }
-
- function peg$classExpectation(parts: IClassParts, inverted: boolean, ignoreCase: boolean): IClassExpectation {
- return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
- }
-
- function peg$anyExpectation(): IAnyExpectation {
- return { type: "any" };
- }
-
- function peg$endExpectation(): IEndExpectation {
- return { type: "end" };
- }
-
- function peg$otherExpectation(description: string): IOtherExpectation {
- return { type: "other", description: description };
- }
-
- function peg$computePosDetails(pos: number) {
- let details = peg$posDetailsCache[pos];
- let p;
-
- if (details) {
- return details;
- } else {
- p = pos - 1;
- while (!peg$posDetailsCache[p]) {
- p--;
- }
-
- details = peg$posDetailsCache[p];
- details = {
- line: details.line,
- column: details.column
- };
-
- while (p < pos) {
- if (input.charCodeAt(p) === 10) {
- details.line++;
- details.column = 1;
- } else {
- details.column++;
- }
-
- p++;
- }
-
- peg$posDetailsCache[pos] = details;
-
- return details;
- }
- }
-
- function peg$computeLocation(startPos: number, endPos: number): IFileRange {
- const startPosDetails = peg$computePosDetails(startPos);
- const endPosDetails = peg$computePosDetails(endPos);
-
- return {
- start: {
- offset: startPos,
- line: startPosDetails.line,
- column: startPosDetails.column
- },
- end: {
- offset: endPos,
- line: endPosDetails.line,
- column: endPosDetails.column
- }
- };
- }
-
- function peg$fail(expected1: Expectation) {
- if (peg$currPos < peg$maxFailPos) { return; }
-
- if (peg$currPos > peg$maxFailPos) {
- peg$maxFailPos = peg$currPos;
- peg$maxFailExpected = [];
- }
-
- peg$maxFailExpected.push(expected1);
- }
-
- function peg$buildSimpleError(message: string, location1: IFileRange) {
- return new SyntaxError(message, [], "", location1);
- }
-
- function peg$buildStructuredError(expected1: Expectation[], found: string | null, location1: IFileRange) {
- return new SyntaxError(
- SyntaxError.buildMessage(expected1, found),
- expected1,
- found,
- location1
- );
- }
-
- function peg$parsestart(): MessageFormatElement[] {
- let s0;
-
- s0 = peg$parsemessage();
-
- return s0;
- }
-
- function peg$parsemessage(): MessageFormatElement[] {
- let s0, s1;
-
- s0 = [];
- s1 = peg$parsemessageElement();
- while (s1 !== peg$FAILED) {
- s0.push(s1);
- s1 = peg$parsemessageElement();
- }
-
- return s0;
- }
-
- function peg$parsemessageElement(): any {
- let s0, s1, s2;
-
- s0 = peg$currPos;
- peg$savedPos = peg$currPos;
- s1 = peg$c0();
- if (s1) {
- s1 = undefined;
- } else {
- s1 = peg$FAILED;
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsetagElement();
- if (s2 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c1(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- if (s0 === peg$FAILED) {
- s0 = peg$parseliteralElement();
- if (s0 === peg$FAILED) {
- s0 = peg$parseargumentElement();
- if (s0 === peg$FAILED) {
- s0 = peg$parsesimpleFormatElement();
- if (s0 === peg$FAILED) {
- s0 = peg$parsepluralElement();
- if (s0 === peg$FAILED) {
- s0 = peg$parseselectElement();
- if (s0 === peg$FAILED) {
- s0 = peg$parsepoundElement();
- }
- }
- }
- }
- }
- }
-
- return s0;
- }
-
- function peg$parsemessageText(): any {
- let s0, s1, s2, s3;
-
- s0 = peg$currPos;
- peg$savedPos = peg$currPos;
- s1 = peg$c2();
- if (s1) {
- s1 = undefined;
- } else {
- s1 = peg$FAILED;
- }
- if (s1 !== peg$FAILED) {
- s2 = [];
- s3 = peg$parsedoubleApostrophes();
- if (s3 === peg$FAILED) {
- s3 = peg$parsequotedString();
- if (s3 === peg$FAILED) {
- s3 = peg$parseunquotedString();
- if (s3 === peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 60) {
- s3 = peg$c3;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c4); }
- }
- }
- }
- }
- if (s3 !== peg$FAILED) {
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- s3 = peg$parsedoubleApostrophes();
- if (s3 === peg$FAILED) {
- s3 = peg$parsequotedString();
- if (s3 === peg$FAILED) {
- s3 = peg$parseunquotedString();
- if (s3 === peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 60) {
- s3 = peg$c3;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c4); }
- }
- }
- }
- }
- }
- } else {
- s2 = peg$FAILED;
- }
- if (s2 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c5(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- if (s0 === peg$FAILED) {
- s0 = peg$currPos;
- s1 = [];
- s2 = peg$parsedoubleApostrophes();
- if (s2 === peg$FAILED) {
- s2 = peg$parsequotedString();
- if (s2 === peg$FAILED) {
- s2 = peg$parseunquotedString();
- if (s2 === peg$FAILED) {
- s2 = peg$parsenonTagStartingAngleBracket();
- }
- }
- }
- if (s2 !== peg$FAILED) {
- while (s2 !== peg$FAILED) {
- s1.push(s2);
- s2 = peg$parsedoubleApostrophes();
- if (s2 === peg$FAILED) {
- s2 = peg$parsequotedString();
- if (s2 === peg$FAILED) {
- s2 = peg$parseunquotedString();
- if (s2 === peg$FAILED) {
- s2 = peg$parsenonTagStartingAngleBracket();
- }
- }
- }
- }
- } else {
- s1 = peg$FAILED;
- }
- if (s1 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c5(s1);
- }
- s0 = s1;
- }
-
- return s0;
- }
-
- function peg$parsenonTagStartingAngleBracket(): any {
- let s0, s1, s2;
-
- s0 = peg$currPos;
- s1 = peg$currPos;
- peg$silentFails++;
- s2 = peg$parseopeningTag();
- if (s2 === peg$FAILED) {
- s2 = peg$parseclosingTag();
- if (s2 === peg$FAILED) {
- s2 = peg$parseselfClosingTag();
- }
- }
- peg$silentFails--;
- if (s2 === peg$FAILED) {
- s1 = undefined;
- } else {
- peg$currPos = s1;
- s1 = peg$FAILED;
- }
- if (s1 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 60) {
- s2 = peg$c3;
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c4); }
- }
- if (s2 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c6();
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
-
- return s0;
- }
-
- function peg$parseliteralElement(): LiteralElement {
- let s0, s1;
-
- s0 = peg$currPos;
- s1 = peg$parsemessageText();
- if (s1 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c7(s1);
- }
- s0 = s1;
-
- return s0;
- }
-
- function peg$parsepoundElement(): PoundElement {
- let s0, s1;
-
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 35) {
- s1 = peg$c8;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c9); }
- }
- if (s1 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c10();
- }
- s0 = s1;
-
- return s0;
- }
-
- function peg$parsetagElement(): TagElement {
- let s0, s1, s2, s3;
-
- peg$silentFails++;
- s0 = peg$parseselfClosingTag();
- if (s0 === peg$FAILED) {
- s0 = peg$currPos;
- s1 = peg$parseopeningTag();
- if (s1 !== peg$FAILED) {
- s2 = peg$parsemessage();
- if (s2 !== peg$FAILED) {
- s3 = peg$parseclosingTag();
- if (s3 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c12(s1, s2, s3);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
- }
-
- return s0;
- }
-
- function peg$parseselfClosingTag(): any {
- let s0, s1, s2, s3, s4, s5;
-
- s0 = peg$currPos;
- s1 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 60) {
- s2 = peg$c3;
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c4); }
- }
- if (s2 !== peg$FAILED) {
- s3 = peg$parsevalidTag();
- if (s3 !== peg$FAILED) {
- s4 = peg$parse_();
- if (s4 !== peg$FAILED) {
- if (input.substr(peg$currPos, 2) === peg$c13) {
- s5 = peg$c13;
- peg$currPos += 2;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c14); }
- }
- if (s5 !== peg$FAILED) {
- s2 = [s2, s3, s4, s5];
- s1 = s2;
- } else {
- peg$currPos = s1;
- s1 = peg$FAILED;
- }
- } else {
- peg$currPos = s1;
- s1 = peg$FAILED;
- }
- } else {
- peg$currPos = s1;
- s1 = peg$FAILED;
- }
- } else {
- peg$currPos = s1;
- s1 = peg$FAILED;
- }
- if (s1 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c15(s1);
- }
- s0 = s1;
-
- return s0;
- }
-
- function peg$parseopeningTag(): any {
- let s0, s1, s2, s3;
-
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 60) {
- s1 = peg$c3;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c4); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsevalidTag();
- if (s2 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 62) {
- s3 = peg$c16;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c17); }
- }
- if (s3 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c18(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
-
- return s0;
- }
-
- function peg$parseclosingTag(): any {
- let s0, s1, s2, s3;
-
- s0 = peg$currPos;
- if (input.substr(peg$currPos, 2) === peg$c19) {
- s1 = peg$c19;
- peg$currPos += 2;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c20); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsevalidTag();
- if (s2 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 62) {
- s3 = peg$c16;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c17); }
- }
- if (s3 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c18(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
-
- return s0;
- }
-
- function peg$parseargumentElement(): ArgumentElement {
- let s0, s1, s2, s3, s4, s5;
-
- peg$silentFails++;
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 123) {
- s1 = peg$c22;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c23); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parse_();
- if (s2 !== peg$FAILED) {
- s3 = peg$parseargNameOrNumber();
- if (s3 !== peg$FAILED) {
- s4 = peg$parse_();
- if (s4 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 125) {
- s5 = peg$c24;
- peg$currPos++;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c25); }
- }
- if (s5 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c26(s3);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c21); }
- }
-
- return s0;
- }
-
- function peg$parsenumberSkeletonId(): any {
- let s0, s1, s2, s3, s4;
-
- peg$silentFails++;
- s0 = peg$currPos;
- s1 = [];
- s2 = peg$currPos;
- s3 = peg$currPos;
- peg$silentFails++;
- s4 = peg$parsewhiteSpace();
- if (s4 === peg$FAILED) {
- if (peg$c28.test(input.charAt(peg$currPos))) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c29); }
- }
- }
- peg$silentFails--;
- if (s4 === peg$FAILED) {
- s3 = undefined;
- } else {
- peg$currPos = s3;
- s3 = peg$FAILED;
- }
- if (s3 !== peg$FAILED) {
- if (input.length > peg$currPos) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c30); }
- }
- if (s4 !== peg$FAILED) {
- s3 = [s3, s4];
- s2 = s3;
- } else {
- peg$currPos = s2;
- s2 = peg$FAILED;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$FAILED;
- }
- if (s2 !== peg$FAILED) {
- while (s2 !== peg$FAILED) {
- s1.push(s2);
- s2 = peg$currPos;
- s3 = peg$currPos;
- peg$silentFails++;
- s4 = peg$parsewhiteSpace();
- if (s4 === peg$FAILED) {
- if (peg$c28.test(input.charAt(peg$currPos))) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c29); }
- }
- }
- peg$silentFails--;
- if (s4 === peg$FAILED) {
- s3 = undefined;
- } else {
- peg$currPos = s3;
- s3 = peg$FAILED;
- }
- if (s3 !== peg$FAILED) {
- if (input.length > peg$currPos) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c30); }
- }
- if (s4 !== peg$FAILED) {
- s3 = [s3, s4];
- s2 = s3;
- } else {
- peg$currPos = s2;
- s2 = peg$FAILED;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$FAILED;
- }
- }
- } else {
- s1 = peg$FAILED;
- }
- if (s1 !== peg$FAILED) {
- s0 = input.substring(s0, peg$currPos);
- } else {
- s0 = s1;
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c27); }
- }
-
- return s0;
- }
-
- function peg$parsenumberSkeletonTokenOption(): any {
- let s0, s1, s2;
-
- peg$silentFails++;
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 47) {
- s1 = peg$c32;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c33); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsenumberSkeletonId();
- if (s2 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c34(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c31); }
- }
-
- return s0;
- }
-
- function peg$parsenumberSkeletonToken(): any {
- let s0, s1, s2, s3, s4;
-
- peg$silentFails++;
- s0 = peg$currPos;
- s1 = peg$parse_();
- if (s1 !== peg$FAILED) {
- s2 = peg$parsenumberSkeletonId();
- if (s2 !== peg$FAILED) {
- s3 = [];
- s4 = peg$parsenumberSkeletonTokenOption();
- while (s4 !== peg$FAILED) {
- s3.push(s4);
- s4 = peg$parsenumberSkeletonTokenOption();
- }
- if (s3 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c36(s2, s3);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c35); }
- }
-
- return s0;
- }
-
- function peg$parsenumberSkeleton(): NumberSkeleton {
- let s0, s1, s2;
-
- s0 = peg$currPos;
- s1 = [];
- s2 = peg$parsenumberSkeletonToken();
- if (s2 !== peg$FAILED) {
- while (s2 !== peg$FAILED) {
- s1.push(s2);
- s2 = peg$parsenumberSkeletonToken();
- }
- } else {
- s1 = peg$FAILED;
- }
- if (s1 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c37(s1);
- }
- s0 = s1;
-
- return s0;
- }
-
- function peg$parsenumberArgStyle(): string | NumberSkeleton {
- let s0, s1, s2;
-
- s0 = peg$currPos;
- if (input.substr(peg$currPos, 2) === peg$c38) {
- s1 = peg$c38;
- peg$currPos += 2;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c39); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsenumberSkeleton();
- if (s2 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c40(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- if (s0 === peg$FAILED) {
- s0 = peg$currPos;
- peg$savedPos = peg$currPos;
- s1 = peg$c41();
- if (s1) {
- s1 = undefined;
- } else {
- s1 = peg$FAILED;
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsemessageText();
- if (s2 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c42(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- }
-
- return s0;
- }
-
- function peg$parsenumberFormatElement(): any {
- let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
-
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 123) {
- s1 = peg$c22;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c23); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parse_();
- if (s2 !== peg$FAILED) {
- s3 = peg$parseargNameOrNumber();
- if (s3 !== peg$FAILED) {
- s4 = peg$parse_();
- if (s4 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 44) {
- s5 = peg$c43;
- peg$currPos++;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c44); }
- }
- if (s5 !== peg$FAILED) {
- s6 = peg$parse_();
- if (s6 !== peg$FAILED) {
- if (input.substr(peg$currPos, 6) === peg$c45) {
- s7 = peg$c45;
- peg$currPos += 6;
- } else {
- s7 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c46); }
- }
- if (s7 !== peg$FAILED) {
- s8 = peg$parse_();
- if (s8 !== peg$FAILED) {
- s9 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 44) {
- s10 = peg$c43;
- peg$currPos++;
- } else {
- s10 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c44); }
- }
- if (s10 !== peg$FAILED) {
- s11 = peg$parse_();
- if (s11 !== peg$FAILED) {
- s12 = peg$parsenumberArgStyle();
- if (s12 !== peg$FAILED) {
- s10 = [s10, s11, s12];
- s9 = s10;
- } else {
- peg$currPos = s9;
- s9 = peg$FAILED;
- }
- } else {
- peg$currPos = s9;
- s9 = peg$FAILED;
- }
- } else {
- peg$currPos = s9;
- s9 = peg$FAILED;
- }
- if (s9 === peg$FAILED) {
- s9 = null;
- }
- if (s9 !== peg$FAILED) {
- s10 = peg$parse_();
- if (s10 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 125) {
- s11 = peg$c24;
- peg$currPos++;
- } else {
- s11 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c25); }
- }
- if (s11 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c47(s3, s7, s9);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
-
- return s0;
- }
-
- function peg$parsedateTimeSkeletonLiteral(): any {
- let s0, s1, s2, s3;
-
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 39) {
- s1 = peg$c48;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c49); }
- }
- if (s1 !== peg$FAILED) {
- s2 = [];
- s3 = peg$parsedoubleApostrophes();
- if (s3 === peg$FAILED) {
- if (peg$c50.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c51); }
- }
- }
- if (s3 !== peg$FAILED) {
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- s3 = peg$parsedoubleApostrophes();
- if (s3 === peg$FAILED) {
- if (peg$c50.test(input.charAt(peg$currPos))) {
- s3 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c51); }
- }
- }
- }
- } else {
- s2 = peg$FAILED;
- }
- if (s2 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 39) {
- s3 = peg$c48;
- peg$currPos++;
- } else {
- s3 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c49); }
- }
- if (s3 !== peg$FAILED) {
- s1 = [s1, s2, s3];
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- if (s0 === peg$FAILED) {
- s0 = [];
- s1 = peg$parsedoubleApostrophes();
- if (s1 === peg$FAILED) {
- if (peg$c52.test(input.charAt(peg$currPos))) {
- s1 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c53); }
- }
- }
- if (s1 !== peg$FAILED) {
- while (s1 !== peg$FAILED) {
- s0.push(s1);
- s1 = peg$parsedoubleApostrophes();
- if (s1 === peg$FAILED) {
- if (peg$c52.test(input.charAt(peg$currPos))) {
- s1 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c53); }
- }
- }
- }
- } else {
- s0 = peg$FAILED;
- }
- }
-
- return s0;
- }
-
- function peg$parsedateTimeSkeletonPattern(): any {
- let s0, s1;
-
- s0 = [];
- if (peg$c54.test(input.charAt(peg$currPos))) {
- s1 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c55); }
- }
- if (s1 !== peg$FAILED) {
- while (s1 !== peg$FAILED) {
- s0.push(s1);
- if (peg$c54.test(input.charAt(peg$currPos))) {
- s1 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c55); }
- }
- }
- } else {
- s0 = peg$FAILED;
- }
-
- return s0;
- }
-
- function peg$parsedateTimeSkeleton(): DateTimeSkeleton {
- let s0, s1, s2, s3;
-
- s0 = peg$currPos;
- s1 = peg$currPos;
- s2 = [];
- s3 = peg$parsedateTimeSkeletonLiteral();
- if (s3 === peg$FAILED) {
- s3 = peg$parsedateTimeSkeletonPattern();
- }
- if (s3 !== peg$FAILED) {
- while (s3 !== peg$FAILED) {
- s2.push(s3);
- s3 = peg$parsedateTimeSkeletonLiteral();
- if (s3 === peg$FAILED) {
- s3 = peg$parsedateTimeSkeletonPattern();
- }
- }
- } else {
- s2 = peg$FAILED;
- }
- if (s2 !== peg$FAILED) {
- s1 = input.substring(s1, peg$currPos);
- } else {
- s1 = s2;
- }
- if (s1 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c56(s1);
- }
- s0 = s1;
-
- return s0;
- }
-
- function peg$parsedateOrTimeArgStyle(): any {
- let s0, s1, s2;
-
- s0 = peg$currPos;
- if (input.substr(peg$currPos, 2) === peg$c38) {
- s1 = peg$c38;
- peg$currPos += 2;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c39); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsedateTimeSkeleton();
- if (s2 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c40(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- if (s0 === peg$FAILED) {
- s0 = peg$currPos;
- peg$savedPos = peg$currPos;
- s1 = peg$c57();
- if (s1) {
- s1 = undefined;
- } else {
- s1 = peg$FAILED;
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parsemessageText();
- if (s2 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c42(s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- }
-
- return s0;
- }
-
- function peg$parsedateOrTimeFormatElement(): any {
- let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
-
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 123) {
- s1 = peg$c22;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c23); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parse_();
- if (s2 !== peg$FAILED) {
- s3 = peg$parseargNameOrNumber();
- if (s3 !== peg$FAILED) {
- s4 = peg$parse_();
- if (s4 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 44) {
- s5 = peg$c43;
- peg$currPos++;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c44); }
- }
- if (s5 !== peg$FAILED) {
- s6 = peg$parse_();
- if (s6 !== peg$FAILED) {
- if (input.substr(peg$currPos, 4) === peg$c58) {
- s7 = peg$c58;
- peg$currPos += 4;
- } else {
- s7 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c59); }
- }
- if (s7 === peg$FAILED) {
- if (input.substr(peg$currPos, 4) === peg$c60) {
- s7 = peg$c60;
- peg$currPos += 4;
- } else {
- s7 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c61); }
- }
- }
- if (s7 !== peg$FAILED) {
- s8 = peg$parse_();
- if (s8 !== peg$FAILED) {
- s9 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 44) {
- s10 = peg$c43;
- peg$currPos++;
- } else {
- s10 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c44); }
- }
- if (s10 !== peg$FAILED) {
- s11 = peg$parse_();
- if (s11 !== peg$FAILED) {
- s12 = peg$parsedateOrTimeArgStyle();
- if (s12 !== peg$FAILED) {
- s10 = [s10, s11, s12];
- s9 = s10;
- } else {
- peg$currPos = s9;
- s9 = peg$FAILED;
- }
- } else {
- peg$currPos = s9;
- s9 = peg$FAILED;
- }
- } else {
- peg$currPos = s9;
- s9 = peg$FAILED;
- }
- if (s9 === peg$FAILED) {
- s9 = null;
- }
- if (s9 !== peg$FAILED) {
- s10 = peg$parse_();
- if (s10 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 125) {
- s11 = peg$c24;
- peg$currPos++;
- } else {
- s11 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c25); }
- }
- if (s11 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c47(s3, s7, s9);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
-
- return s0;
- }
-
- function peg$parsesimpleFormatElement():
- | NumberElement
- | DateElement
- | TimeElement
- {
- let s0;
-
- s0 = peg$parsenumberFormatElement();
- if (s0 === peg$FAILED) {
- s0 = peg$parsedateOrTimeFormatElement();
- }
-
- return s0;
- }
-
- function peg$parsepluralElement(): PluralElement {
- let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15;
-
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 123) {
- s1 = peg$c22;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c23); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parse_();
- if (s2 !== peg$FAILED) {
- s3 = peg$parseargNameOrNumber();
- if (s3 !== peg$FAILED) {
- s4 = peg$parse_();
- if (s4 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 44) {
- s5 = peg$c43;
- peg$currPos++;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c44); }
- }
- if (s5 !== peg$FAILED) {
- s6 = peg$parse_();
- if (s6 !== peg$FAILED) {
- if (input.substr(peg$currPos, 6) === peg$c62) {
- s7 = peg$c62;
- peg$currPos += 6;
- } else {
- s7 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c63); }
- }
- if (s7 === peg$FAILED) {
- if (input.substr(peg$currPos, 13) === peg$c64) {
- s7 = peg$c64;
- peg$currPos += 13;
- } else {
- s7 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c65); }
- }
- }
- if (s7 !== peg$FAILED) {
- s8 = peg$parse_();
- if (s8 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 44) {
- s9 = peg$c43;
- peg$currPos++;
- } else {
- s9 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c44); }
- }
- if (s9 !== peg$FAILED) {
- s10 = peg$parse_();
- if (s10 !== peg$FAILED) {
- s11 = peg$currPos;
- if (input.substr(peg$currPos, 7) === peg$c66) {
- s12 = peg$c66;
- peg$currPos += 7;
- } else {
- s12 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c67); }
- }
- if (s12 !== peg$FAILED) {
- s13 = peg$parse_();
- if (s13 !== peg$FAILED) {
- s14 = peg$parsenumber();
- if (s14 !== peg$FAILED) {
- s12 = [s12, s13, s14];
- s11 = s12;
- } else {
- peg$currPos = s11;
- s11 = peg$FAILED;
- }
- } else {
- peg$currPos = s11;
- s11 = peg$FAILED;
- }
- } else {
- peg$currPos = s11;
- s11 = peg$FAILED;
- }
- if (s11 === peg$FAILED) {
- s11 = null;
- }
- if (s11 !== peg$FAILED) {
- s12 = peg$parse_();
- if (s12 !== peg$FAILED) {
- s13 = [];
- s14 = peg$parsepluralOption();
- if (s14 !== peg$FAILED) {
- while (s14 !== peg$FAILED) {
- s13.push(s14);
- s14 = peg$parsepluralOption();
- }
- } else {
- s13 = peg$FAILED;
- }
- if (s13 !== peg$FAILED) {
- s14 = peg$parse_();
- if (s14 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 125) {
- s15 = peg$c24;
- peg$currPos++;
- } else {
- s15 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c25); }
- }
- if (s15 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c68(s3, s7, s11, s13);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
-
- return s0;
- }
-
- function peg$parseselectElement(): SelectElement {
- let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
-
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 123) {
- s1 = peg$c22;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c23); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parse_();
- if (s2 !== peg$FAILED) {
- s3 = peg$parseargNameOrNumber();
- if (s3 !== peg$FAILED) {
- s4 = peg$parse_();
- if (s4 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 44) {
- s5 = peg$c43;
- peg$currPos++;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c44); }
- }
- if (s5 !== peg$FAILED) {
- s6 = peg$parse_();
- if (s6 !== peg$FAILED) {
- if (input.substr(peg$currPos, 6) === peg$c69) {
- s7 = peg$c69;
- peg$currPos += 6;
- } else {
- s7 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c70); }
- }
- if (s7 !== peg$FAILED) {
- s8 = peg$parse_();
- if (s8 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 44) {
- s9 = peg$c43;
- peg$currPos++;
- } else {
- s9 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c44); }
- }
- if (s9 !== peg$FAILED) {
- s10 = peg$parse_();
- if (s10 !== peg$FAILED) {
- s11 = [];
- s12 = peg$parseselectOption();
- if (s12 !== peg$FAILED) {
- while (s12 !== peg$FAILED) {
- s11.push(s12);
- s12 = peg$parseselectOption();
- }
- } else {
- s11 = peg$FAILED;
- }
- if (s11 !== peg$FAILED) {
- s12 = peg$parse_();
- if (s12 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 125) {
- s13 = peg$c24;
- peg$currPos++;
- } else {
- s13 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c25); }
- }
- if (s13 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c71(s3, s11);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
-
- return s0;
- }
-
- function peg$parsepluralRuleSelectValue(): any {
- let s0, s1, s2, s3;
-
- s0 = peg$currPos;
- s1 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 61) {
- s2 = peg$c72;
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c73); }
- }
- if (s2 !== peg$FAILED) {
- s3 = peg$parsenumber();
- if (s3 !== peg$FAILED) {
- s2 = [s2, s3];
- s1 = s2;
- } else {
- peg$currPos = s1;
- s1 = peg$FAILED;
- }
- } else {
- peg$currPos = s1;
- s1 = peg$FAILED;
- }
- if (s1 !== peg$FAILED) {
- s0 = input.substring(s0, peg$currPos);
- } else {
- s0 = s1;
- }
- if (s0 === peg$FAILED) {
- s0 = peg$parseargName();
- }
-
- return s0;
- }
-
- function peg$parseselectOption(): PluralOrSelectOption {
- let s0, s1, s2, s3, s4, s5, s6, s7;
-
- s0 = peg$currPos;
- s1 = peg$parse_();
- if (s1 !== peg$FAILED) {
- s2 = peg$parseargName();
- if (s2 !== peg$FAILED) {
- s3 = peg$parse_();
- if (s3 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 123) {
- s4 = peg$c22;
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c23); }
- }
- if (s4 !== peg$FAILED) {
- peg$savedPos = peg$currPos;
- s5 = peg$c74(s2);
- if (s5) {
- s5 = undefined;
- } else {
- s5 = peg$FAILED;
- }
- if (s5 !== peg$FAILED) {
- s6 = peg$parsemessage();
- if (s6 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 125) {
- s7 = peg$c24;
- peg$currPos++;
- } else {
- s7 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c25); }
- }
- if (s7 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c75(s2, s6);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
-
- return s0;
- }
-
- function peg$parsepluralOption(): PluralOrSelectOption {
- let s0, s1, s2, s3, s4, s5, s6, s7;
-
- s0 = peg$currPos;
- s1 = peg$parse_();
- if (s1 !== peg$FAILED) {
- s2 = peg$parsepluralRuleSelectValue();
- if (s2 !== peg$FAILED) {
- s3 = peg$parse_();
- if (s3 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 123) {
- s4 = peg$c22;
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c23); }
- }
- if (s4 !== peg$FAILED) {
- peg$savedPos = peg$currPos;
- s5 = peg$c76(s2);
- if (s5) {
- s5 = undefined;
- } else {
- s5 = peg$FAILED;
- }
- if (s5 !== peg$FAILED) {
- s6 = peg$parsemessage();
- if (s6 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 125) {
- s7 = peg$c24;
- peg$currPos++;
- } else {
- s7 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c25); }
- }
- if (s7 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c77(s2, s6);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
-
- return s0;
- }
-
- function peg$parsewhiteSpace(): any {
- let s0, s1;
-
- peg$silentFails++;
- if (peg$c79.test(input.charAt(peg$currPos))) {
- s0 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s0 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c80); }
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c78); }
- }
-
- return s0;
- }
-
- function peg$parsepatternSyntax(): any {
- let s0, s1;
-
- peg$silentFails++;
- if (peg$c82.test(input.charAt(peg$currPos))) {
- s0 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s0 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c83); }
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c81); }
- }
-
- return s0;
- }
-
- function peg$parse_(): any {
- let s0, s1, s2;
-
- peg$silentFails++;
- s0 = peg$currPos;
- s1 = [];
- s2 = peg$parsewhiteSpace();
- while (s2 !== peg$FAILED) {
- s1.push(s2);
- s2 = peg$parsewhiteSpace();
- }
- if (s1 !== peg$FAILED) {
- s0 = input.substring(s0, peg$currPos);
- } else {
- s0 = s1;
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c84); }
- }
-
- return s0;
- }
-
- function peg$parsenumber(): number {
- let s0, s1, s2;
-
- peg$silentFails++;
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 45) {
- s1 = peg$c86;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c87); }
- }
- if (s1 === peg$FAILED) {
- s1 = null;
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parseargNumber();
- if (s2 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c88(s1, s2);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c85); }
- }
-
- return s0;
- }
-
- function peg$parseapostrophe(): string {
- let s0, s1;
-
- peg$silentFails++;
- if (input.charCodeAt(peg$currPos) === 39) {
- s0 = peg$c48;
- peg$currPos++;
- } else {
- s0 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c49); }
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c89); }
- }
-
- return s0;
- }
-
- function peg$parsedoubleApostrophes(): any {
- let s0, s1;
-
- peg$silentFails++;
- s0 = peg$currPos;
- if (input.substr(peg$currPos, 2) === peg$c91) {
- s1 = peg$c91;
- peg$currPos += 2;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c92); }
- }
- if (s1 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c93();
- }
- s0 = s1;
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c90); }
- }
-
- return s0;
- }
-
- function peg$parsequotedString(): any {
- let s0, s1, s2, s3, s4, s5;
-
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 39) {
- s1 = peg$c48;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c49); }
- }
- if (s1 !== peg$FAILED) {
- s2 = peg$parseescapedChar();
- if (s2 !== peg$FAILED) {
- s3 = peg$currPos;
- s4 = [];
- if (input.substr(peg$currPos, 2) === peg$c91) {
- s5 = peg$c91;
- peg$currPos += 2;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c92); }
- }
- if (s5 === peg$FAILED) {
- if (peg$c50.test(input.charAt(peg$currPos))) {
- s5 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c51); }
- }
- }
- while (s5 !== peg$FAILED) {
- s4.push(s5);
- if (input.substr(peg$currPos, 2) === peg$c91) {
- s5 = peg$c91;
- peg$currPos += 2;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c92); }
- }
- if (s5 === peg$FAILED) {
- if (peg$c50.test(input.charAt(peg$currPos))) {
- s5 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s5 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c51); }
- }
- }
- }
- if (s4 !== peg$FAILED) {
- s3 = input.substring(s3, peg$currPos);
- } else {
- s3 = s4;
- }
- if (s3 !== peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 39) {
- s4 = peg$c48;
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c49); }
- }
- if (s4 === peg$FAILED) {
- s4 = null;
- }
- if (s4 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c94(s2, s3);
- s0 = s1;
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
- } else {
- peg$currPos = s0;
- s0 = peg$FAILED;
- }
-
- return s0;
- }
-
- function peg$parseunquotedString(): any {
- let s0, s1, s2, s3;
-
- s0 = peg$currPos;
- s1 = peg$currPos;
- if (input.length > peg$currPos) {
- s2 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c30); }
- }
- if (s2 !== peg$FAILED) {
- peg$savedPos = peg$currPos;
- s3 = peg$c95(s2);
- if (s3) {
- s3 = undefined;
- } else {
- s3 = peg$FAILED;
- }
- if (s3 !== peg$FAILED) {
- s2 = [s2, s3];
- s1 = s2;
- } else {
- peg$currPos = s1;
- s1 = peg$FAILED;
- }
- } else {
- peg$currPos = s1;
- s1 = peg$FAILED;
- }
- if (s1 === peg$FAILED) {
- if (input.charCodeAt(peg$currPos) === 10) {
- s1 = peg$c96;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c97); }
- }
- }
- if (s1 !== peg$FAILED) {
- s0 = input.substring(s0, peg$currPos);
- } else {
- s0 = s1;
- }
-
- return s0;
- }
-
- function peg$parseescapedChar(): any {
- let s0, s1, s2, s3;
-
- s0 = peg$currPos;
- s1 = peg$currPos;
- if (input.length > peg$currPos) {
- s2 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c30); }
- }
- if (s2 !== peg$FAILED) {
- peg$savedPos = peg$currPos;
- s3 = peg$c98(s2);
- if (s3) {
- s3 = undefined;
- } else {
- s3 = peg$FAILED;
- }
- if (s3 !== peg$FAILED) {
- s2 = [s2, s3];
- s1 = s2;
- } else {
- peg$currPos = s1;
- s1 = peg$FAILED;
- }
- } else {
- peg$currPos = s1;
- s1 = peg$FAILED;
- }
- if (s1 !== peg$FAILED) {
- s0 = input.substring(s0, peg$currPos);
- } else {
- s0 = s1;
- }
-
- return s0;
- }
-
- function peg$parseargNameOrNumber(): any {
- let s0, s1;
-
- peg$silentFails++;
- s0 = peg$currPos;
- s1 = peg$parseargNumber();
- if (s1 === peg$FAILED) {
- s1 = peg$parseargName();
- }
- if (s1 !== peg$FAILED) {
- s0 = input.substring(s0, peg$currPos);
- } else {
- s0 = s1;
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c99); }
- }
-
- return s0;
- }
-
- function peg$parsevalidTag(): any {
- let s0, s1;
-
- peg$silentFails++;
- s0 = peg$currPos;
- s1 = peg$parseargNumber();
- if (s1 === peg$FAILED) {
- s1 = peg$parsetagName();
- }
- if (s1 !== peg$FAILED) {
- s0 = input.substring(s0, peg$currPos);
- } else {
- s0 = s1;
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c100); }
- }
-
- return s0;
- }
-
- function peg$parseargNumber(): any {
- let s0, s1, s2, s3, s4;
-
- peg$silentFails++;
- s0 = peg$currPos;
- if (input.charCodeAt(peg$currPos) === 48) {
- s1 = peg$c102;
- peg$currPos++;
- } else {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c103); }
- }
- if (s1 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c104();
- }
- s0 = s1;
- if (s0 === peg$FAILED) {
- s0 = peg$currPos;
- s1 = peg$currPos;
- if (peg$c105.test(input.charAt(peg$currPos))) {
- s2 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c106); }
- }
- if (s2 !== peg$FAILED) {
- s3 = [];
- if (peg$c107.test(input.charAt(peg$currPos))) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c108); }
- }
- while (s4 !== peg$FAILED) {
- s3.push(s4);
- if (peg$c107.test(input.charAt(peg$currPos))) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c108); }
- }
- }
- if (s3 !== peg$FAILED) {
- s2 = [s2, s3];
- s1 = s2;
- } else {
- peg$currPos = s1;
- s1 = peg$FAILED;
- }
- } else {
- peg$currPos = s1;
- s1 = peg$FAILED;
- }
- if (s1 !== peg$FAILED) {
- peg$savedPos = s0;
- s1 = peg$c109(s1);
- }
- s0 = s1;
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c101); }
- }
-
- return s0;
- }
-
- function peg$parseargName(): any {
- let s0, s1, s2, s3, s4;
-
- peg$silentFails++;
- s0 = peg$currPos;
- s1 = [];
- s2 = peg$currPos;
- s3 = peg$currPos;
- peg$silentFails++;
- s4 = peg$parsewhiteSpace();
- if (s4 === peg$FAILED) {
- s4 = peg$parsepatternSyntax();
- }
- peg$silentFails--;
- if (s4 === peg$FAILED) {
- s3 = undefined;
- } else {
- peg$currPos = s3;
- s3 = peg$FAILED;
- }
- if (s3 !== peg$FAILED) {
- if (input.length > peg$currPos) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c30); }
- }
- if (s4 !== peg$FAILED) {
- s3 = [s3, s4];
- s2 = s3;
- } else {
- peg$currPos = s2;
- s2 = peg$FAILED;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$FAILED;
- }
- if (s2 !== peg$FAILED) {
- while (s2 !== peg$FAILED) {
- s1.push(s2);
- s2 = peg$currPos;
- s3 = peg$currPos;
- peg$silentFails++;
- s4 = peg$parsewhiteSpace();
- if (s4 === peg$FAILED) {
- s4 = peg$parsepatternSyntax();
- }
- peg$silentFails--;
- if (s4 === peg$FAILED) {
- s3 = undefined;
- } else {
- peg$currPos = s3;
- s3 = peg$FAILED;
- }
- if (s3 !== peg$FAILED) {
- if (input.length > peg$currPos) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c30); }
- }
- if (s4 !== peg$FAILED) {
- s3 = [s3, s4];
- s2 = s3;
- } else {
- peg$currPos = s2;
- s2 = peg$FAILED;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$FAILED;
- }
- }
- } else {
- s1 = peg$FAILED;
- }
- if (s1 !== peg$FAILED) {
- s0 = input.substring(s0, peg$currPos);
- } else {
- s0 = s1;
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c110); }
- }
-
- return s0;
- }
-
- function peg$parsetagName(): any {
- let s0, s1, s2, s3, s4;
-
- peg$silentFails++;
- s0 = peg$currPos;
- s1 = [];
- if (input.charCodeAt(peg$currPos) === 45) {
- s2 = peg$c86;
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c87); }
- }
- if (s2 === peg$FAILED) {
- s2 = peg$currPos;
- s3 = peg$currPos;
- peg$silentFails++;
- s4 = peg$parsewhiteSpace();
- if (s4 === peg$FAILED) {
- s4 = peg$parsepatternSyntax();
- }
- peg$silentFails--;
- if (s4 === peg$FAILED) {
- s3 = undefined;
- } else {
- peg$currPos = s3;
- s3 = peg$FAILED;
- }
- if (s3 !== peg$FAILED) {
- if (input.length > peg$currPos) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c30); }
- }
- if (s4 !== peg$FAILED) {
- s3 = [s3, s4];
- s2 = s3;
- } else {
- peg$currPos = s2;
- s2 = peg$FAILED;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$FAILED;
- }
- }
- if (s2 !== peg$FAILED) {
- while (s2 !== peg$FAILED) {
- s1.push(s2);
- if (input.charCodeAt(peg$currPos) === 45) {
- s2 = peg$c86;
- peg$currPos++;
- } else {
- s2 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c87); }
- }
- if (s2 === peg$FAILED) {
- s2 = peg$currPos;
- s3 = peg$currPos;
- peg$silentFails++;
- s4 = peg$parsewhiteSpace();
- if (s4 === peg$FAILED) {
- s4 = peg$parsepatternSyntax();
- }
- peg$silentFails--;
- if (s4 === peg$FAILED) {
- s3 = undefined;
- } else {
- peg$currPos = s3;
- s3 = peg$FAILED;
- }
- if (s3 !== peg$FAILED) {
- if (input.length > peg$currPos) {
- s4 = input.charAt(peg$currPos);
- peg$currPos++;
- } else {
- s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c30); }
- }
- if (s4 !== peg$FAILED) {
- s3 = [s3, s4];
- s2 = s3;
- } else {
- peg$currPos = s2;
- s2 = peg$FAILED;
- }
- } else {
- peg$currPos = s2;
- s2 = peg$FAILED;
- }
- }
- }
- } else {
- s1 = peg$FAILED;
- }
- if (s1 !== peg$FAILED) {
- s0 = input.substring(s0, peg$currPos);
- } else {
- s0 = s1;
- }
- peg$silentFails--;
- if (s0 === peg$FAILED) {
- s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c111); }
- }
-
- return s0;
- }
-
-
- const messageCtx = ['root'];
-
- function isNestedMessageText() {
- return messageCtx.length > 1;
- }
-
- function isInPluralOption() {
- return messageCtx[messageCtx.length - 1] === 'plural';
- }
-
- function insertLocation() {
- return options && options.captureLocation ? {
- location: location()
- }: {}
- }
-
- const ignoreTag = options && options.ignoreTag;
- const shouldParseSkeleton = options && options.shouldParseSkeleton;
-
-
- peg$result = peg$startRuleFunction();
-
- if (peg$result !== peg$FAILED && peg$currPos === input.length) {
- return peg$result;
- } else {
- if (peg$result !== peg$FAILED && peg$currPos < input.length) {
- peg$fail(peg$endExpectation());
- }
-
- throw peg$buildStructuredError(
- peg$maxFailExpected,
- peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
- peg$maxFailPos < input.length
- ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
- : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
- );
- }
-}
-
-export interface IParseOptions {
- filename?: string;
- startRule?: string;
- tracer?: any;
- [key: string]: any;
-}
-export type ParseFunction = (input: string, options?: IParseOptions) => MessageFormatElement[];
-export const pegParse: ParseFunction = peg$parse;
diff --git a/packages/intl-messageformat-parser/src/printer.ts b/packages/intl-messageformat-parser/src/printer.ts
deleted file mode 100644
index f3a46d34c2..0000000000
--- a/packages/intl-messageformat-parser/src/printer.ts
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2015, Yahoo Inc.
- * Copyrights licensed under the New BSD License.
- * See the accompanying LICENSE file for terms.
- */
-
-import {
- MessageFormatElement,
- isLiteralElement,
- LiteralElement,
- ArgumentElement,
- DateElement,
- TimeElement,
- NumberElement,
- SelectElement,
- PluralElement,
- TagElement,
- isTagElement,
- isSelectElement,
- isArgumentElement,
- isDateElement,
- isTimeElement,
- isNumberElement,
- isPluralElement,
- TYPE,
- Skeleton,
- SKELETON_TYPE,
- NumberSkeletonToken,
- DateTimeSkeleton,
- isPoundElement,
-} from './types'
-
-export function printAST(ast: MessageFormatElement[]): string {
- return doPrintAST(ast, false)
-}
-
-export function doPrintAST(
- ast: MessageFormatElement[],
- isInPlural: boolean
-): string {
- const printedNodes = ast.map(el => {
- if (isLiteralElement(el)) {
- return printLiteralElement(el, isInPlural)
- }
-
- if (isArgumentElement(el)) {
- return printArgumentElement(el)
- }
- if (isDateElement(el) || isTimeElement(el) || isNumberElement(el)) {
- return printSimpleFormatElement(el)
- }
-
- if (isPluralElement(el)) {
- return printPluralElement(el)
- }
-
- if (isSelectElement(el)) {
- return printSelectElement(el)
- }
-
- if (isPoundElement(el)) {
- return '#'
- }
- if (isTagElement(el)) {
- return printTagElement(el)
- }
- })
-
- return printedNodes.join('')
-}
-
-function printTagElement(el: TagElement): string {
- return `<${el.value}>${printAST(el.children)}${el.value}>`
-}
-
-function printEscapedMessage(message: string): string {
- return message.replace(/([{}](?:.*[{}])?)/su, `'$1'`)
-}
-
-function printLiteralElement({value}: LiteralElement, isInPlural: boolean) {
- const escaped = printEscapedMessage(value)
- return isInPlural ? escaped.replace('#', "'#'") : escaped
-}
-
-function printArgumentElement({value}: ArgumentElement) {
- return `{${value}}`
-}
-
-function printSimpleFormatElement(
- el: DateElement | TimeElement | NumberElement
-) {
- return `{${el.value}, ${TYPE[el.type]}${
- el.style ? `, ${printArgumentStyle(el.style)}` : ''
- }}`
-}
-
-function printNumberSkeletonToken(token: NumberSkeletonToken): string {
- const {stem, options} = token
- return options.length === 0
- ? stem
- : `${stem}${options.map(o => `/${o}`).join('')}`
-}
-
-function printArgumentStyle(style: string | Skeleton) {
- if (typeof style === 'string') {
- return printEscapedMessage(style)
- } else if (style.type === SKELETON_TYPE.dateTime) {
- return `::${printDateTimeSkeleton(style)}`
- } else {
- return `::${style.tokens.map(printNumberSkeletonToken).join(' ')}`
- }
-}
-
-export function printDateTimeSkeleton(style: DateTimeSkeleton): string {
- return style.pattern
-}
-
-function printSelectElement(el: SelectElement) {
- const msg = [
- el.value,
- 'select',
- Object.keys(el.options)
- .map(id => `${id}{${doPrintAST(el.options[id].value, false)}}`)
- .join(' '),
- ].join(',')
- return `{${msg}}`
-}
-
-function printPluralElement(el: PluralElement) {
- const type = el.pluralType === 'cardinal' ? 'plural' : 'selectordinal'
- const msg = [
- el.value,
- type,
- [
- el.offset ? `offset:${el.offset}` : '',
- ...Object.keys(el.options).map(
- id => `${id}{${doPrintAST(el.options[id].value, true)}}`
- ),
- ]
- .filter(Boolean)
- .join(' '),
- ].join(',')
- return `{${msg}}`
-}
diff --git a/packages/intl-messageformat-parser/src/skeleton.ts b/packages/intl-messageformat-parser/src/skeleton.ts
deleted file mode 100644
index 39855a4de5..0000000000
--- a/packages/intl-messageformat-parser/src/skeleton.ts
+++ /dev/null
@@ -1,459 +0,0 @@
-import {ExtendedNumberFormatOptions, NumberSkeletonToken} from './types'
-
-/**
- * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
- * Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js
- * with some tweaks
- */
-const DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g
-
-export interface ExtendedDateTimeFormatOptions
- extends Intl.DateTimeFormatOptions {
- hourCycle?: 'h11' | 'h12' | 'h23' | 'h24'
-}
-
-/**
- * Parse Date time skeleton into Intl.DateTimeFormatOptions
- * Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
- * @public
- * @param skeleton skeleton string
- */
-export function parseDateTimeSkeleton(
- skeleton: string
-): ExtendedDateTimeFormatOptions {
- const result: ExtendedDateTimeFormatOptions = {}
- skeleton.replace(DATE_TIME_REGEX, match => {
- const len = match.length
- switch (match[0]) {
- // Era
- case 'G':
- result.era = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short'
- break
- // Year
- case 'y':
- result.year = len === 2 ? '2-digit' : 'numeric'
- break
- case 'Y':
- case 'u':
- case 'U':
- case 'r':
- throw new RangeError(
- '`Y/u/U/r` (year) patterns are not supported, use `y` instead'
- )
- // Quarter
- case 'q':
- case 'Q':
- throw new RangeError('`q/Q` (quarter) patterns are not supported')
- // Month
- case 'M':
- case 'L':
- result.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][
- len - 1
- ] as 'numeric'
- break
- // Week
- case 'w':
- case 'W':
- throw new RangeError('`w/W` (week) patterns are not supported')
- case 'd':
- result.day = ['numeric', '2-digit'][len - 1] as 'numeric'
- break
- case 'D':
- case 'F':
- case 'g':
- throw new RangeError(
- '`D/F/g` (day) patterns are not supported, use `d` instead'
- )
- // Weekday
- case 'E':
- result.weekday = len === 4 ? 'short' : len === 5 ? 'narrow' : 'short'
- break
- case 'e':
- if (len < 4) {
- throw new RangeError('`e..eee` (weekday) patterns are not supported')
- }
- result.weekday = ['short', 'long', 'narrow', 'short'][
- len - 4
- ] as 'short'
- break
- case 'c':
- if (len < 4) {
- throw new RangeError('`c..ccc` (weekday) patterns are not supported')
- }
- result.weekday = ['short', 'long', 'narrow', 'short'][
- len - 4
- ] as 'short'
- break
-
- // Period
- case 'a': // AM, PM
- result.hour12 = true
- break
- case 'b': // am, pm, noon, midnight
- case 'B': // flexible day periods
- throw new RangeError(
- '`b/B` (period) patterns are not supported, use `a` instead'
- )
- // Hour
- case 'h':
- result.hourCycle = 'h12'
- result.hour = ['numeric', '2-digit'][len - 1] as 'numeric'
- break
- case 'H':
- result.hourCycle = 'h23'
- result.hour = ['numeric', '2-digit'][len - 1] as 'numeric'
- break
- case 'K':
- result.hourCycle = 'h11'
- result.hour = ['numeric', '2-digit'][len - 1] as 'numeric'
- break
- case 'k':
- result.hourCycle = 'h24'
- result.hour = ['numeric', '2-digit'][len - 1] as 'numeric'
- break
- case 'j':
- case 'J':
- case 'C':
- throw new RangeError(
- '`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead'
- )
- // Minute
- case 'm':
- result.minute = ['numeric', '2-digit'][len - 1] as 'numeric'
- break
- // Second
- case 's':
- result.second = ['numeric', '2-digit'][len - 1] as 'numeric'
- break
- case 'S':
- case 'A':
- throw new RangeError(
- '`S/A` (second) patterns are not supported, use `s` instead'
- )
- // Zone
- case 'z': // 1..3, 4: specific non-location format
- result.timeZoneName = len < 4 ? 'short' : 'long'
- break
- case 'Z': // 1..3, 4, 5: The ISO8601 varios formats
- case 'O': // 1, 4: miliseconds in day short, long
- case 'v': // 1, 4: generic non-location format
- case 'V': // 1, 2, 3, 4: time zone ID or city
- case 'X': // 1, 2, 3, 4: The ISO8601 varios formats
- case 'x': // 1, 2, 3, 4: The ISO8601 varios formats
- throw new RangeError(
- '`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead'
- )
- }
- return ''
- })
- return result
-}
-
-function icuUnitToEcma(unit: string): ExtendedNumberFormatOptions['unit'] {
- return unit.replace(/^(.*?)-/, '') as ExtendedNumberFormatOptions['unit']
-}
-
-const FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g
-const SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?$/g
-const INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g
-const CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/
-
-function parseSignificantPrecision(str: string): ExtendedNumberFormatOptions {
- const result: ExtendedNumberFormatOptions = {}
- str.replace(
- SIGNIFICANT_PRECISION_REGEX,
- function (_: string, g1: string, g2: string | number) {
- // @@@ case
- if (typeof g2 !== 'string') {
- result.minimumSignificantDigits = g1.length
- result.maximumSignificantDigits = g1.length
- }
- // @@@+ case
- else if (g2 === '+') {
- result.minimumSignificantDigits = g1.length
- }
- // .### case
- else if (g1[0] === '#') {
- result.maximumSignificantDigits = g1.length
- }
- // .@@## or .@@@ case
- else {
- result.minimumSignificantDigits = g1.length
- result.maximumSignificantDigits =
- g1.length + (typeof g2 === 'string' ? g2.length : 0)
- }
- return ''
- }
- )
- return result
-}
-
-function parseSign(str: string): ExtendedNumberFormatOptions | undefined {
- switch (str) {
- case 'sign-auto':
- return {
- signDisplay: 'auto',
- }
- case 'sign-accounting':
- case '()':
- return {
- currencySign: 'accounting',
- }
- case 'sign-always':
- case '+!':
- return {
- signDisplay: 'always',
- }
- case 'sign-accounting-always':
- case '()!':
- return {
- signDisplay: 'always',
- currencySign: 'accounting',
- }
- case 'sign-except-zero':
- case '+?':
- return {
- signDisplay: 'exceptZero',
- }
- case 'sign-accounting-except-zero':
- case '()?':
- return {
- signDisplay: 'exceptZero',
- currencySign: 'accounting',
- }
- case 'sign-never':
- case '+_':
- return {
- signDisplay: 'never',
- }
- }
-}
-
-function parseConciseScientificAndEngineeringStem(
- stem: string
-): ExtendedNumberFormatOptions | undefined {
- // Engineering
- let result: ExtendedNumberFormatOptions | undefined
- if (stem[0] === 'E' && stem[1] === 'E') {
- result = {
- notation: 'engineering',
- }
- stem = stem.slice(2)
- } else if (stem[0] === 'E') {
- result = {
- notation: 'scientific',
- }
- stem = stem.slice(1)
- }
- if (result) {
- const signDisplay = stem.slice(0, 2)
- if (signDisplay === '+!') {
- result.signDisplay = 'always'
- stem = stem.slice(2)
- } else if (signDisplay === '+?') {
- result.signDisplay = 'exceptZero'
- stem = stem.slice(2)
- }
- if (!CONCISE_INTEGER_WIDTH_REGEX.test(stem)) {
- throw new Error('Malformed concise eng/scientific notation')
- }
- result.minimumIntegerDigits = stem.length
- }
- return result
-}
-
-function parseNotationOptions(opt: string): ExtendedNumberFormatOptions {
- const result: ExtendedNumberFormatOptions = {}
- const signOpts = parseSign(opt)
- if (signOpts) {
- return signOpts
- }
- return result
-}
-
-/**
- * https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options
- */
-export function parseNumberSkeleton(
- tokens: NumberSkeletonToken[]
-): ExtendedNumberFormatOptions {
- let result: ExtendedNumberFormatOptions = {}
- for (const token of tokens) {
- switch (token.stem) {
- case 'percent':
- case '%':
- result.style = 'percent'
- continue
- case '%x100':
- result.style = 'percent'
- result.scale = 100
- continue
- case 'currency':
- result.style = 'currency'
- result.currency = token.options[0]
- continue
- case 'group-off':
- case ',_':
- result.useGrouping = false
- continue
- case 'precision-integer':
- case '.':
- result.maximumFractionDigits = 0
- continue
- case 'measure-unit':
- case 'unit':
- result.style = 'unit'
- result.unit = icuUnitToEcma(token.options[0])
- continue
- case 'compact-short':
- case 'K':
- result.notation = 'compact'
- result.compactDisplay = 'short'
- continue
- case 'compact-long':
- case 'KK':
- result.notation = 'compact'
- result.compactDisplay = 'long'
- continue
- case 'scientific':
- result = {
- ...result,
- notation: 'scientific',
- ...token.options.reduce(
- (all, opt) => ({...all, ...parseNotationOptions(opt)}),
- {}
- ),
- }
- continue
- case 'engineering':
- result = {
- ...result,
- notation: 'engineering',
- ...token.options.reduce(
- (all, opt) => ({...all, ...parseNotationOptions(opt)}),
- {}
- ),
- }
- continue
- case 'notation-simple':
- result.notation = 'standard'
- continue
- // https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h
- case 'unit-width-narrow':
- result.currencyDisplay = 'narrowSymbol'
- result.unitDisplay = 'narrow'
- continue
- case 'unit-width-short':
- result.currencyDisplay = 'code'
- result.unitDisplay = 'short'
- continue
- case 'unit-width-full-name':
- result.currencyDisplay = 'name'
- result.unitDisplay = 'long'
- continue
- case 'unit-width-iso-code':
- result.currencyDisplay = 'symbol'
- continue
- case 'scale':
- result.scale = parseFloat(token.options[0])
- continue
- // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width
- case 'integer-width':
- if (token.options.length > 1) {
- throw new RangeError(
- 'integer-width stems only accept a single optional option'
- )
- }
- token.options[0].replace(
- INTEGER_WIDTH_REGEX,
- function (
- _: string,
- g1: string,
- g2: string,
- g3: string,
- g4: string,
- g5: string
- ) {
- if (g1) {
- result.minimumIntegerDigits = g2.length
- } else if (g3 && g4) {
- throw new Error(
- 'We currently do not support maximum integer digits'
- )
- } else if (g5) {
- throw new Error(
- 'We currently do not support exact integer digits'
- )
- }
- return ''
- }
- )
- continue
- }
- // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width
- if (CONCISE_INTEGER_WIDTH_REGEX.test(token.stem)) {
- result.minimumIntegerDigits = token.stem.length
- continue
- }
- if (FRACTION_PRECISION_REGEX.test(token.stem)) {
- // Precision
- // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#fraction-precision
- // precision-integer case
- if (token.options.length > 1) {
- throw new RangeError(
- 'Fraction-precision stems only accept a single optional option'
- )
- }
- token.stem.replace(
- FRACTION_PRECISION_REGEX,
- function (
- _: string,
- g1: string,
- g2: string | number,
- g3: string,
- g4: string,
- g5: string
- ) {
- // .000* case (before ICU67 it was .000+)
- if (g2 === '*') {
- result.minimumFractionDigits = g1.length
- }
- // .### case
- else if (g3 && g3[0] === '#') {
- result.maximumFractionDigits = g3.length
- }
- // .00## case
- else if (g4 && g5) {
- result.minimumFractionDigits = g4.length
- result.maximumFractionDigits = g4.length + g5.length
- } else {
- result.minimumFractionDigits = g1.length
- result.maximumFractionDigits = g1.length
- }
- return ''
- }
- )
-
- if (token.options.length) {
- result = {...result, ...parseSignificantPrecision(token.options[0])}
- }
- continue
- }
- // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#significant-digits-precision
- if (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) {
- result = {...result, ...parseSignificantPrecision(token.stem)}
- continue
- }
- const signOpts = parseSign(token.stem)
- if (signOpts) {
- result = {...result, ...signOpts}
- }
- const conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(
- token.stem
- )
- if (conciseScientificAndEngineeringOpts) {
- result = {...result, ...conciseScientificAndEngineeringOpts}
- }
- }
- return result
-}
diff --git a/packages/intl-messageformat-parser/src/types.ts b/packages/intl-messageformat-parser/src/types.ts
deleted file mode 100644
index fee95f47b1..0000000000
--- a/packages/intl-messageformat-parser/src/types.ts
+++ /dev/null
@@ -1,240 +0,0 @@
-import {NumberFormatOptions} from '@formatjs/ecma402-abstract'
-
-export interface ExtendedNumberFormatOptions extends NumberFormatOptions {
- scale?: number
-}
-
-export enum TYPE {
- /**
- * Raw text
- */
- literal,
- /**
- * Variable w/o any format, e.g `var` in `this is a {var}`
- */
- argument,
- /**
- * Variable w/ number format
- */
- number,
- /**
- * Variable w/ date format
- */
- date,
- /**
- * Variable w/ time format
- */
- time,
- /**
- * Variable w/ select format
- */
- select,
- /**
- * Variable w/ plural format
- */
- plural,
- /**
- * Only possible within plural argument.
- * This is the `#` symbol that will be substituted with the count.
- */
- pound,
- /**
- * XML-like tag
- */
- tag,
-}
-
-export enum SKELETON_TYPE {
- number,
- dateTime,
-}
-
-export interface LocationDetails {
- offset: number
- line: number
- column: number
-}
-export interface Location {
- start: LocationDetails
- end: LocationDetails
-}
-
-export interface BaseElement {
- type: T
- value: string
- location?: Location
-}
-
-export type LiteralElement = BaseElement
-export type ArgumentElement = BaseElement
-export interface TagElement {
- type: TYPE.tag
- value: string
- children: MessageFormatElement[]
- location?: Location
-}
-
-export interface SimpleFormatElement
- extends BaseElement {
- style?: string | S | null
-}
-
-export type NumberElement = SimpleFormatElement
-export type DateElement = SimpleFormatElement
-export type TimeElement = SimpleFormatElement
-
-export interface SelectOption {
- id: string
- value: MessageFormatElement[]
- location?: Location
-}
-
-export type ValidPluralRule =
- | 'zero'
- | 'one'
- | 'two'
- | 'few'
- | 'many'
- | 'other'
- | string
-
-export interface PluralOrSelectOption {
- value: MessageFormatElement[]
- location?: Location
-}
-
-export interface SelectElement extends BaseElement {
- options: Record
-}
-
-export interface PluralElement extends BaseElement {
- options: Record
- offset: number
- pluralType: Intl.PluralRulesOptions['type']
-}
-
-export interface PoundElement {
- type: TYPE.pound
- location?: Location
-}
-
-export type MessageFormatElement =
- | LiteralElement
- | ArgumentElement
- | NumberElement
- | DateElement
- | TimeElement
- | SelectElement
- | PluralElement
- | TagElement
- | PoundElement
-
-export interface NumberSkeletonToken {
- stem: string
- options: string[]
-}
-
-export interface NumberSkeleton {
- type: SKELETON_TYPE.number
- tokens: NumberSkeletonToken[]
- location?: Location
- parsedOptions: ExtendedNumberFormatOptions
-}
-
-export interface DateTimeSkeleton {
- type: SKELETON_TYPE.dateTime
- pattern: string
- location?: Location
- parsedOptions: Intl.DateTimeFormatOptions
-}
-
-export type Skeleton = NumberSkeleton | DateTimeSkeleton
-
-/**
- * Type Guards
- */
-export function isLiteralElement(
- el: MessageFormatElement
-): el is LiteralElement {
- return el.type === TYPE.literal
-}
-export function isArgumentElement(
- el: MessageFormatElement
-): el is ArgumentElement {
- return el.type === TYPE.argument
-}
-export function isNumberElement(el: MessageFormatElement): el is NumberElement {
- return el.type === TYPE.number
-}
-export function isDateElement(el: MessageFormatElement): el is DateElement {
- return el.type === TYPE.date
-}
-export function isTimeElement(el: MessageFormatElement): el is TimeElement {
- return el.type === TYPE.time
-}
-export function isSelectElement(el: MessageFormatElement): el is SelectElement {
- return el.type === TYPE.select
-}
-export function isPluralElement(el: MessageFormatElement): el is PluralElement {
- return el.type === TYPE.plural
-}
-export function isPoundElement(el: MessageFormatElement): el is PoundElement {
- return el.type === TYPE.pound
-}
-export function isTagElement(el: MessageFormatElement): el is TagElement {
- return el.type === TYPE.tag
-}
-export function isNumberSkeleton(
- el: NumberElement['style'] | Skeleton
-): el is NumberSkeleton {
- return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.number)
-}
-export function isDateTimeSkeleton(
- el?: DateElement['style'] | TimeElement['style'] | Skeleton
-): el is DateTimeSkeleton {
- return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.dateTime)
-}
-
-export function createLiteralElement(value: string): LiteralElement {
- return {
- type: TYPE.literal,
- value,
- }
-}
-
-export function createNumberElement(
- value: string,
- style?: string | null
-): NumberElement {
- return {
- type: TYPE.number,
- value,
- style,
- }
-}
-
-export interface Options {
- /**
- * Whether to convert `#` in plural rule options
- * to `{var, number}`
- * Default is true
- */
- normalizeHashtagInPlural?: boolean
- /**
- * Whether to parse number/datetime skeleton
- * into Intl.NumberFormatOptions & Intl.DateTimeFormatOptions
- */
- shouldParseSkeletons?: boolean
- /**
- * Capture location info in AST
- * Default is false
- */
- captureLocation?: boolean
- /**
- * Whether to treat HTML/XML tags as string literal
- * instead of parsing them as tag token.
- * When this is false we only allow simple tags without
- * any attributes
- */
- ignoreTag?: boolean
-}
diff --git a/packages/intl-messageformat-parser/tests/__snapshots__/arg_style.test.ts.snap b/packages/intl-messageformat-parser/tests/__snapshots__/arg_style.test.ts.snap
deleted file mode 100644
index fe327ec00b..0000000000
--- a/packages/intl-messageformat-parser/tests/__snapshots__/arg_style.test.ts.snap
+++ /dev/null
@@ -1,97 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`argStyleText test case: "{0,date,y-M-d HH:mm:ss zzzz}" 1`] = `
-Array [
- Object {
- "style": "y-M-d HH:mm:ss zzzz",
- "type": 3,
- "value": "0",
- },
-]
-`;
-
-exports[`argStyleText test case: "{0,date,y-M-d HH:mm:ss zzzz}" 2`] = `"{0, date, y-M-d HH:mm:ss zzzz}"`;
-
-exports[`argStyleText test case: "{0,date,y-M-d HH:mm:ss}" 1`] = `
-Array [
- Object {
- "style": "y-M-d HH:mm:ss",
- "type": 3,
- "value": "0",
- },
-]
-`;
-
-exports[`argStyleText test case: "{0,date,y-M-d HH:mm:ss}" 2`] = `"{0, date, y-M-d HH:mm:ss}"`;
-
-exports[`argStyleText test case: "{0,date,y-M-d,HH:mm:ss,zzzz}" 1`] = `
-Array [
- Object {
- "style": "y-M-d,HH:mm:ss,zzzz",
- "type": 3,
- "value": "0",
- },
-]
-`;
-
-exports[`argStyleText test case: "{0,date,y-M-d,HH:mm:ss,zzzz}" 2`] = `"{0, date, y-M-d,HH:mm:ss,zzzz}"`;
-
-exports[`argStyleText test case: "{0,number,''}" 1`] = `
-Array [
- Object {
- "style": "'",
- "type": 2,
- "value": "0",
- },
-]
-`;
-
-exports[`argStyleText test case: "{0,number,''}" 2`] = `"{0, number, '}"`;
-
-exports[`argStyleText test case: "{0,number,'{}'}" 1`] = `
-Array [
- Object {
- "style": "{}",
- "type": 2,
- "value": "0",
- },
-]
-`;
-
-exports[`argStyleText test case: "{0,number,'{}'}" 2`] = `"{0, number, '{}'}"`;
-
-exports[`argStyleText test case: "{0,number,y-M-d HH:mm:ss zzzz}" 1`] = `
-Array [
- Object {
- "style": "y-M-d HH:mm:ss zzzz",
- "type": 2,
- "value": "0",
- },
-]
-`;
-
-exports[`argStyleText test case: "{0,number,y-M-d HH:mm:ss zzzz}" 2`] = `"{0, number, y-M-d HH:mm:ss zzzz}"`;
-
-exports[`argStyleText test case: "{0,number,y-M-d HH:mm:ss}" 1`] = `
-Array [
- Object {
- "style": "y-M-d HH:mm:ss",
- "type": 2,
- "value": "0",
- },
-]
-`;
-
-exports[`argStyleText test case: "{0,number,y-M-d HH:mm:ss}" 2`] = `"{0, number, y-M-d HH:mm:ss}"`;
-
-exports[`argStyleText test case: "{0,number,y-M-d,HH:mm:ss,zzzz}" 1`] = `
-Array [
- Object {
- "style": "y-M-d,HH:mm:ss,zzzz",
- "type": 2,
- "value": "0",
- },
-]
-`;
-
-exports[`argStyleText test case: "{0,number,y-M-d,HH:mm:ss,zzzz}" 2`] = `"{0, number, y-M-d,HH:mm:ss,zzzz}"`;
diff --git a/packages/intl-messageformat-parser/tests/__snapshots__/date_skeleton.test.ts.snap b/packages/intl-messageformat-parser/tests/__snapshots__/date_skeleton.test.ts.snap
deleted file mode 100644
index 0996af5c51..0000000000
--- a/packages/intl-messageformat-parser/tests/__snapshots__/date_skeleton.test.ts.snap
+++ /dev/null
@@ -1,95 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`case: "" 1`] = `
-Array [
- Object {
- "style": "::",
- "type": 3,
- "value": "0",
- },
-]
-`;
-
-exports[`case: "" 2`] = `"{0, date, ::}"`;
-
-exports[`case: "" 3`] = `Object {}`;
-
-exports[`case: "EEE, MMM d, ''yy" 1`] = `
-Array [
- Object {
- "style": Object {
- "parsedOptions": Object {},
- "pattern": "EEE, MMM d, ''yy",
- "type": 1,
- },
- "type": 3,
- "value": "0",
- },
-]
-`;
-
-exports[`case: "EEE, MMM d, ''yy" 2`] = `"{0, date, ::EEE, MMM d, ''yy}"`;
-
-exports[`case: "EEE, MMM d, ''yy" 3`] = `
-Object {
- "day": "numeric",
- "month": "short",
- "weekday": "short",
- "year": "2-digit",
-}
-`;
-
-exports[`case: "h:mm a" 1`] = `
-Array [
- Object {
- "style": Object {
- "parsedOptions": Object {},
- "pattern": "h:mm a",
- "type": 1,
- },
- "type": 3,
- "value": "0",
- },
-]
-`;
-
-exports[`case: "h:mm a" 2`] = `"{0, date, ::h:mm a}"`;
-
-exports[`case: "h:mm a" 3`] = `
-Object {
- "hour": "numeric",
- "hour12": true,
- "hourCycle": "h12",
- "minute": "2-digit",
-}
-`;
-
-exports[`case: "yyyy.MM.dd G 'at' HH:mm:ss vvvv" 1`] = `
-Array [
- Object {
- "style": Object {
- "parsedOptions": Object {},
- "pattern": "yyyy.MM.dd G 'at' HH:mm:ss vvvv",
- "type": 1,
- },
- "type": 3,
- "value": "0",
- },
-]
-`;
-
-exports[`case: "yyyy.MM.dd G 'at' HH:mm:ss vvvv" 2`] = `"{0, date, ::yyyy.MM.dd G 'at' HH:mm:ss vvvv}"`;
-
-exports[`case: "yyyy.MM.dd G 'at' HH:mm:ss zzzz" 1`] = `
-Object {
- "day": "2-digit",
- "era": "short",
- "hour": "2-digit",
- "hourCycle": "h23",
- "minute": "2-digit",
- "month": "2-digit",
- "second": "2-digit",
- "timeZoneName": "long",
- "year": "numeric",
-}
-`;
diff --git a/packages/intl-messageformat-parser/tests/__snapshots__/index.test.ts.snap b/packages/intl-messageformat-parser/tests/__snapshots__/index.test.ts.snap
deleted file mode 100644
index cdc629d654..0000000000
--- a/packages/intl-messageformat-parser/tests/__snapshots__/index.test.ts.snap
+++ /dev/null
@@ -1,1803 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`pegParse() can pegParse ' some random test ' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": " some random test ",
- },
-]
-`;
-
-exports[`pegParse() can pegParse ''#'' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "'#'",
- },
-]
-`;
-
-exports[`pegParse() can pegParse ''{'' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "{",
- },
-]
-`;
-
-exports[`pegParse() can pegParse ''{name}'' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "{name}",
- },
-]
-`;
-
-exports[`pegParse() can pegParse ''}'' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "}",
- },
-]
-`;
-
-exports[`pegParse() can pegParse '{ num , number,percent }' 1`] = `
-Array [
- Object {
- "style": "percent",
- "type": 2,
- "value": "num",
- },
-]
-`;
-
-exports[`pegParse() can pegParse '{c, plural, =1 { {text} project} other { {text} projects}}' 1`] = `
-Array [
- Object {
- "offset": 0,
- "options": Object {
- "=1": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 1,
- "value": "text",
- },
- Object {
- "type": 0,
- "value": " project",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 1,
- "value": "text",
- },
- Object {
- "type": 0,
- "value": " projects",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "c",
- },
-]
-`;
-
-exports[`pegParse() can pegParse '{c, plural, =99 { {text} project} other { {text} projects}}' 1`] = `
-Array [
- Object {
- "offset": 0,
- "options": Object {
- "=99": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 1,
- "value": "text",
- },
- Object {
- "type": 0,
- "value": " project",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 1,
- "value": "text",
- },
- Object {
- "type": 0,
- "value": " projects",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "c",
- },
-]
-`;
-
-exports[`pegParse() can pegParse '{c, plural, offset:-2 =-1 { {text} project} other { {text} projects}}' 1`] = `
-Array [
- Object {
- "offset": -2,
- "options": Object {
- "=-1": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 1,
- "value": "text",
- },
- Object {
- "type": 0,
- "value": " project",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 1,
- "value": "text",
- },
- Object {
- "type": 0,
- "value": " projects",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "c",
- },
-]
-`;
-
-exports[`pegParse() can pegParse '{count, time}' 1`] = `
-Array [
- Object {
- "style": null,
- "type": 4,
- "value": "count",
- },
-]
-`;
-
-exports[`pegParse() can pegParse '{floor, selectordinal, =0{ground} one{#st} two{#nd} few{#rd} other{#th}} floor' 1`] = `
-Array [
- Object {
- "offset": 0,
- "options": Object {
- "=0": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "ground",
- },
- ],
- },
- "few": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": "rd",
- },
- ],
- },
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": "st",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": "th",
- },
- ],
- },
- "two": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": "nd",
- },
- ],
- },
- },
- "pluralType": "ordinal",
- "type": 6,
- "value": "floor",
- },
- Object {
- "type": 0,
- "value": " floor",
- },
-]
-`;
-
-exports[`pegParse() can pegParse '{gender, select, female {woman} male {man} other {person}}' 1`] = `
-Array [
- Object {
- "options": Object {
- "female": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "woman",
- },
- ],
- },
- "male": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "man",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "person",
- },
- ],
- },
- },
- "type": 5,
- "value": "gender",
- },
-]
-`;
-
-exports[`pegParse() can pegParse '{howMany, select, one {{actor1}} other { {nExtraActors, plural, one {{actor1} and {actor2}} other {{actor1} and {nExtraActors} others} }} } shared this file.' 1`] = `
-Array [
- Object {
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "actor1",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "actor1",
- },
- Object {
- "type": 0,
- "value": " and ",
- },
- Object {
- "type": 1,
- "value": "actor2",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "actor1",
- },
- Object {
- "type": 0,
- "value": " and ",
- },
- Object {
- "type": 1,
- "value": "nExtraActors",
- },
- Object {
- "type": 0,
- "value": " others",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "nExtraActors",
- },
- ],
- },
- },
- "type": 5,
- "value": "howMany",
- },
- Object {
- "type": 0,
- "value": " shared this file.",
- },
-]
-`;
-
-exports[`pegParse() can pegParse '{num, number, percent}' 1`] = `
-Array [
- Object {
- "style": "percent",
- "type": 2,
- "value": "num",
- },
-]
-`;
-
-exports[`pegParse() can pegParse '{numPhotos, plural, =0{no photos} =1{one photo} other{# photos}}' 1`] = `
-Array [
- Object {
- "offset": 0,
- "options": Object {
- "=0": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "no photos",
- },
- ],
- },
- "=1": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "one photo",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " photos",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "numPhotos",
- },
-]
-`;
-
-exports[`pegParse() can pegParse '{type, select,
- drop {
- {units, plural,
- one {# drop}
- other {# drops}
- }
- }
- teaspoon {
- {units, plural,
- one {# teaspoon}
- other {# teaspoons}
- }
- }
- tablespoon {
- {units, plural,
- one {# tablespoon}
- other {# tablespoons}
- }
- }
- }' 1`] = `
-Array [
- Object {
- "options": Object {
- "drop": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "
- ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " drop",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " drops",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "units",
- },
- Object {
- "type": 0,
- "value": "
- ",
- },
- ],
- },
- "tablespoon": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "
- ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " tablespoon",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " tablespoons",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "units",
- },
- Object {
- "type": 0,
- "value": "
- ",
- },
- ],
- },
- "teaspoon": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "
- ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " teaspoon",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " teaspoons",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "units",
- },
- Object {
- "type": 0,
- "value": "
- ",
- },
- ],
- },
- },
- "type": 5,
- "value": "type",
- },
-]
-`;
-
-exports[`pegParse() can pegParse 'Foo {var1, plural, =0{# var1} other{{var2, plural, =0{# var2} other{# var2-other}} # other}}' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "Foo ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "=0": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " var1",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "offset": 0,
- "options": Object {
- "=0": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " var2",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " var2-other",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "var2",
- },
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " other",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "var1",
- },
-]
-`;
-
-exports[`pegParse() can pegParse 'Hello, {name}!' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "Hello, ",
- },
- Object {
- "type": 1,
- "value": "name",
- },
- Object {
- "type": 0,
- "value": "!",
- },
-]
-`;
-
-exports[`pegParse() can pegParse 'Hello, World!' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "Hello, World!",
- },
-]
-`;
-
-exports[`pegParse() can pegParse 'My name is {FIRST} {LAST}, age {age, number}, time {time, time}, date {date, date}.' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "My name is ",
- },
- Object {
- "type": 1,
- "value": "FIRST",
- },
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 1,
- "value": "LAST",
- },
- Object {
- "type": 0,
- "value": ", age ",
- },
- Object {
- "style": null,
- "type": 2,
- "value": "age",
- },
- Object {
- "type": 0,
- "value": ", time ",
- },
- Object {
- "style": null,
- "type": 4,
- "value": "time",
- },
- Object {
- "type": 0,
- "value": ", date ",
- },
- Object {
- "style": null,
- "type": 3,
- "value": "date",
- },
- Object {
- "type": 0,
- "value": ".",
- },
-]
-`;
-
-exports[`pegParse() can pegParse 'This '{isn''t}' obvious' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "This {isn't} obvious",
- },
-]
-`;
-
-exports[`pegParse() can pegParse 'this is {count,plural,offset:1 one{{count, number} dog} other{{count, number} dogs}}' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "this is ",
- },
- Object {
- "offset": 1,
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "style": null,
- "type": 2,
- "value": "count",
- },
- Object {
- "type": 0,
- "value": " dog",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "style": null,
- "type": 2,
- "value": "count",
- },
- Object {
- "type": 0,
- "value": " dogs",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "count",
- },
-]
-`;
-
-exports[`pegParse() can print AST from ' some random test ' 1`] = `" some random test "`;
-
-exports[`pegParse() can print AST from ''#'' 1`] = `"'#'"`;
-
-exports[`pegParse() can print AST from ''{'' 1`] = `"'{'"`;
-
-exports[`pegParse() can print AST from ''{name}'' 1`] = `"'{name}'"`;
-
-exports[`pegParse() can print AST from ''}'' 1`] = `"'}'"`;
-
-exports[`pegParse() can print AST from '{ num , number,percent }' 1`] = `"{num, number, percent}"`;
-
-exports[`pegParse() can print AST from '{c, plural, =1 { {text} project} other { {text} projects}}' 1`] = `"{c,plural,=1{ {text} project} other{ {text} projects}}"`;
-
-exports[`pegParse() can print AST from '{c, plural, =99 { {text} project} other { {text} projects}}' 1`] = `"{c,plural,=99{ {text} project} other{ {text} projects}}"`;
-
-exports[`pegParse() can print AST from '{c, plural, offset:-2 =-1 { {text} project} other { {text} projects}}' 1`] = `"{c,plural,offset:-2 =-1{ {text} project} other{ {text} projects}}"`;
-
-exports[`pegParse() can print AST from '{count, time}' 1`] = `"{count, time}"`;
-
-exports[`pegParse() can print AST from '{floor, selectordinal, =0{ground} one{#st} two{#nd} few{#rd} other{#th}} floor' 1`] = `"{floor,selectordinal,=0{ground} one{#st} two{#nd} few{#rd} other{#th}} floor"`;
-
-exports[`pegParse() can print AST from '{gender, select, female {woman} male {man} other {person}}' 1`] = `"{gender,select,female{woman} male{man} other{person}}"`;
-
-exports[`pegParse() can print AST from '{howMany, select, one {{actor1}} other { {nExtraActors, plural, one {{actor1} and {actor2}} other {{actor1} and {nExtraActors} others} }} } shared this file.' 1`] = `"{howMany,select,one{{actor1}} other{ {nExtraActors,plural,one{{actor1} and {actor2}} other{{actor1} and {nExtraActors} others}}}} shared this file."`;
-
-exports[`pegParse() can print AST from '{num, number, percent}' 1`] = `"{num, number, percent}"`;
-
-exports[`pegParse() can print AST from '{numPhotos, plural, =0{no photos} =1{one photo} other{# photos}}' 1`] = `"{numPhotos,plural,=0{no photos} =1{one photo} other{# photos}}"`;
-
-exports[`pegParse() can print AST from '{type, select,
- drop {
- {units, plural,
- one {# drop}
- other {# drops}
- }
- }
- teaspoon {
- {units, plural,
- one {# teaspoon}
- other {# teaspoons}
- }
- }
- tablespoon {
- {units, plural,
- one {# tablespoon}
- other {# tablespoons}
- }
- }
- }' 1`] = `
-"{type,select,drop{
- {units,plural,one{# drop} other{# drops}}
- } teaspoon{
- {units,plural,one{# teaspoon} other{# teaspoons}}
- } tablespoon{
- {units,plural,one{# tablespoon} other{# tablespoons}}
- }}"
-`;
-
-exports[`pegParse() can print AST from 'Foo {var1, plural, =0{# var1} other{{var2, plural, =0{# var2} other{# var2-other}} # other}}' 1`] = `"Foo {var1,plural,=0{# var1} other{{var2,plural,=0{# var2} other{# var2-other}} # other}}"`;
-
-exports[`pegParse() can print AST from 'Hello, {name}!' 1`] = `"Hello, {name}!"`;
-
-exports[`pegParse() can print AST from 'Hello, World!' 1`] = `"Hello, World!"`;
-
-exports[`pegParse() can print AST from 'My name is {FIRST} {LAST}, age {age, number}, time {time, time}, date {date, date}.' 1`] = `"My name is {FIRST} {LAST}, age {age, number}, time {time, time}, date {date, date}."`;
-
-exports[`pegParse() can print AST from 'This '{isn''t}' obvious' 1`] = `"This '{isn't}' obvious"`;
-
-exports[`pegParse() can print AST from 'this is {count,plural,offset:1 one{{count, number} dog} other{{count, number} dogs}}' 1`] = `"this is {count,plural,offset:1 one{{count, number} dog} other{{count, number} dogs}}"`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse ' some random test ' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": " some random test ",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse ''#'' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "'#'",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse ''{'' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "{",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse ''{name}'' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "{name}",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse ''}'' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "}",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse '{ num , number,percent }' 1`] = `
-Array [
- Object {
- "style": "percent",
- "type": 2,
- "value": "num",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse '{c, plural, =1 { {text} project} other { {text} projects}}' 1`] = `
-Array [
- Object {
- "offset": 0,
- "options": Object {
- "=1": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 1,
- "value": "text",
- },
- Object {
- "type": 0,
- "value": " project",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 1,
- "value": "text",
- },
- Object {
- "type": 0,
- "value": " projects",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "c",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse '{c, plural, =99 { {text} project} other { {text} projects}}' 1`] = `
-Array [
- Object {
- "offset": 0,
- "options": Object {
- "=99": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 1,
- "value": "text",
- },
- Object {
- "type": 0,
- "value": " project",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 1,
- "value": "text",
- },
- Object {
- "type": 0,
- "value": " projects",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "c",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse '{c, plural, offset:-2 =-1 { {text} project} other { {text} projects}}' 1`] = `
-Array [
- Object {
- "offset": -2,
- "options": Object {
- "=-1": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 1,
- "value": "text",
- },
- Object {
- "type": 0,
- "value": " project",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 1,
- "value": "text",
- },
- Object {
- "type": 0,
- "value": " projects",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "c",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse '{count, time}' 1`] = `
-Array [
- Object {
- "style": null,
- "type": 4,
- "value": "count",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse '{floor, selectordinal, =0{ground} one{#st} two{#nd} few{#rd} other{#th}} floor' 1`] = `
-Array [
- Object {
- "offset": 0,
- "options": Object {
- "=0": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "ground",
- },
- ],
- },
- "few": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": "rd",
- },
- ],
- },
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": "st",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": "th",
- },
- ],
- },
- "two": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": "nd",
- },
- ],
- },
- },
- "pluralType": "ordinal",
- "type": 6,
- "value": "floor",
- },
- Object {
- "type": 0,
- "value": " floor",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse '{gender, select, female {woman} male {man} other {person}}' 1`] = `
-Array [
- Object {
- "options": Object {
- "female": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "woman",
- },
- ],
- },
- "male": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "man",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "person",
- },
- ],
- },
- },
- "type": 5,
- "value": "gender",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse '{howMany, select, one {{actor1}} other { {nExtraActors, plural, one {{actor1} and {actor2}} other {{actor1} and {nExtraActors} others} }} } shared this file.' 1`] = `
-Array [
- Object {
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "actor1",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "actor1",
- },
- Object {
- "type": 0,
- "value": " and ",
- },
- Object {
- "type": 1,
- "value": "actor2",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "actor1",
- },
- Object {
- "type": 0,
- "value": " and ",
- },
- Object {
- "type": 1,
- "value": "nExtraActors",
- },
- Object {
- "type": 0,
- "value": " others",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "nExtraActors",
- },
- ],
- },
- },
- "type": 5,
- "value": "howMany",
- },
- Object {
- "type": 0,
- "value": " shared this file.",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse '{num, number, percent}' 1`] = `
-Array [
- Object {
- "style": "percent",
- "type": 2,
- "value": "num",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse '{numPhotos, plural, =0{no photos} =1{one photo} other{# photos}}' 1`] = `
-Array [
- Object {
- "offset": 0,
- "options": Object {
- "=0": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "no photos",
- },
- ],
- },
- "=1": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "one photo",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " photos",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "numPhotos",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse '{type, select,
- drop {
- {units, plural,
- one {# drop}
- other {# drops}
- }
- }
- teaspoon {
- {units, plural,
- one {# teaspoon}
- other {# teaspoons}
- }
- }
- tablespoon {
- {units, plural,
- one {# tablespoon}
- other {# tablespoons}
- }
- }
- }' 1`] = `
-Array [
- Object {
- "options": Object {
- "drop": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "
- ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " drop",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " drops",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "units",
- },
- Object {
- "type": 0,
- "value": "
- ",
- },
- ],
- },
- "tablespoon": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "
- ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " tablespoon",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " tablespoons",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "units",
- },
- Object {
- "type": 0,
- "value": "
- ",
- },
- ],
- },
- "teaspoon": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "
- ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " teaspoon",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " teaspoons",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "units",
- },
- Object {
- "type": 0,
- "value": "
- ",
- },
- ],
- },
- },
- "type": 5,
- "value": "type",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse 'Foo {var1, plural, =0{# var1} other{{var2, plural, =0{# var2} other{# var2-other}} # other}}' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "Foo ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "=0": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " var1",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "offset": 0,
- "options": Object {
- "=0": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " var2",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " var2-other",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "var2",
- },
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " other",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "var1",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse 'Hello, {name}!' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "Hello, ",
- },
- Object {
- "type": 1,
- "value": "name",
- },
- Object {
- "type": 0,
- "value": "!",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse 'Hello, World!' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "Hello, World!",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse 'My name is {FIRST} {LAST}, age {age, number}, time {time, time}, date {date, date}.' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "My name is ",
- },
- Object {
- "type": 1,
- "value": "FIRST",
- },
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "type": 1,
- "value": "LAST",
- },
- Object {
- "type": 0,
- "value": ", age ",
- },
- Object {
- "style": null,
- "type": 2,
- "value": "age",
- },
- Object {
- "type": 0,
- "value": ", time ",
- },
- Object {
- "style": null,
- "type": 4,
- "value": "time",
- },
- Object {
- "type": 0,
- "value": ", date ",
- },
- Object {
- "style": null,
- "type": 3,
- "value": "date",
- },
- Object {
- "type": 0,
- "value": ".",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse 'This '{isn''t}' obvious' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "This {isn't} obvious",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can pegParse 'this is {count,plural,offset:1 one{{count, number} dog} other{{count, number} dogs}}' 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "this is ",
- },
- Object {
- "offset": 1,
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "style": null,
- "type": 2,
- "value": "count",
- },
- Object {
- "type": 0,
- "value": " dog",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "style": null,
- "type": 2,
- "value": "count",
- },
- Object {
- "type": 0,
- "value": " dogs",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "count",
- },
-]
-`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from ' some random test ' 1`] = `" some random test "`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from ''#'' 1`] = `"'#'"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from ''{'' 1`] = `"'{'"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from ''{name}'' 1`] = `"'{name}'"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from ''}'' 1`] = `"'}'"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from '{ num , number,percent }' 1`] = `"{num, number, percent}"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from '{c, plural, =1 { {text} project} other { {text} projects}}' 1`] = `"{c,plural,=1{ {text} project} other{ {text} projects}}"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from '{c, plural, =99 { {text} project} other { {text} projects}}' 1`] = `"{c,plural,=99{ {text} project} other{ {text} projects}}"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from '{c, plural, offset:-2 =-1 { {text} project} other { {text} projects}}' 1`] = `"{c,plural,offset:-2 =-1{ {text} project} other{ {text} projects}}"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from '{count, time}' 1`] = `"{count, time}"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from '{floor, selectordinal, =0{ground} one{#st} two{#nd} few{#rd} other{#th}} floor' 1`] = `"{floor,selectordinal,=0{ground} one{#st} two{#nd} few{#rd} other{#th}} floor"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from '{gender, select, female {woman} male {man} other {person}}' 1`] = `"{gender,select,female{woman} male{man} other{person}}"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from '{howMany, select, one {{actor1}} other { {nExtraActors, plural, one {{actor1} and {actor2}} other {{actor1} and {nExtraActors} others} }} } shared this file.' 1`] = `"{howMany,select,one{{actor1}} other{ {nExtraActors,plural,one{{actor1} and {actor2}} other{{actor1} and {nExtraActors} others}}}} shared this file."`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from '{num, number, percent}' 1`] = `"{num, number, percent}"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from '{numPhotos, plural, =0{no photos} =1{one photo} other{# photos}}' 1`] = `"{numPhotos,plural,=0{no photos} =1{one photo} other{# photos}}"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from '{type, select,
- drop {
- {units, plural,
- one {# drop}
- other {# drops}
- }
- }
- teaspoon {
- {units, plural,
- one {# teaspoon}
- other {# teaspoons}
- }
- }
- tablespoon {
- {units, plural,
- one {# tablespoon}
- other {# tablespoons}
- }
- }
- }' 1`] = `
-"{type,select,drop{
- {units,plural,one{# drop} other{# drops}}
- } teaspoon{
- {units,plural,one{# teaspoon} other{# teaspoons}}
- } tablespoon{
- {units,plural,one{# tablespoon} other{# tablespoons}}
- }}"
-`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from 'Foo {var1, plural, =0{# var1} other{{var2, plural, =0{# var2} other{# var2-other}} # other}}' 1`] = `"Foo {var1,plural,=0{# var1} other{{var2,plural,=0{# var2} other{# var2-other}} # other}}"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from 'Hello, {name}!' 1`] = `"Hello, {name}!"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from 'Hello, World!' 1`] = `"Hello, World!"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from 'My name is {FIRST} {LAST}, age {age, number}, time {time, time}, date {date, date}.' 1`] = `"My name is {FIRST} {LAST}, age {age, number}, time {time, time}, date {date, date}."`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from 'This '{isn''t}' obvious' 1`] = `"This '{isn't}' obvious"`;
-
-exports[`pegParse({ captureLocation: true }) can print AST from 'this is {count,plural,offset:1 one{{count, number} dog} other{{count, number} dogs}}' 1`] = `"this is {count,plural,offset:1 one{{count, number} dog} other{{count, number} dogs}}"`;
diff --git a/packages/intl-messageformat-parser/tests/__snapshots__/nested.test.ts.snap b/packages/intl-messageformat-parser/tests/__snapshots__/nested.test.ts.snap
deleted file mode 100644
index 39edb7122e..0000000000
--- a/packages/intl-messageformat-parser/tests/__snapshots__/nested.test.ts.snap
+++ /dev/null
@@ -1,319 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`plural arg nested inside select arg 1`] = `
-Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "options": Object {
- "female": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "
- ",
- },
- Object {
- "offset": 1,
- "options": Object {
- "=0": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "host",
- },
- Object {
- "type": 0,
- "value": " does not give a party.",
- },
- ],
- },
- "=1": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "host",
- },
- Object {
- "type": 0,
- "value": " invites ",
- },
- Object {
- "type": 1,
- "value": "guest",
- },
- Object {
- "type": 0,
- "value": " to her party.",
- },
- ],
- },
- "=2": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "host",
- },
- Object {
- "type": 0,
- "value": " invites ",
- },
- Object {
- "type": 1,
- "value": "guest",
- },
- Object {
- "type": 0,
- "value": " and one other person to her party.",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "host",
- },
- Object {
- "type": 0,
- "value": " invites ",
- },
- Object {
- "type": 1,
- "value": "guest",
- },
- Object {
- "type": 0,
- "value": " and ",
- },
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " other people to her party.",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "num_guests",
- },
- ],
- },
- "male": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "
- ",
- },
- Object {
- "offset": 1,
- "options": Object {
- "=0": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "host",
- },
- Object {
- "type": 0,
- "value": " does not give a party.",
- },
- ],
- },
- "=1": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "host",
- },
- Object {
- "type": 0,
- "value": " invites ",
- },
- Object {
- "type": 1,
- "value": "guest",
- },
- Object {
- "type": 0,
- "value": " to his party.",
- },
- ],
- },
- "=2": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "host",
- },
- Object {
- "type": 0,
- "value": " invites ",
- },
- Object {
- "type": 1,
- "value": "guest",
- },
- Object {
- "type": 0,
- "value": " and one other person to his party.",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "host",
- },
- Object {
- "type": 0,
- "value": " invites ",
- },
- Object {
- "type": 1,
- "value": "guest",
- },
- Object {
- "type": 0,
- "value": " and ",
- },
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " other people to his party.",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "num_guests",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "
- ",
- },
- Object {
- "offset": 1,
- "options": Object {
- "=0": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "host",
- },
- Object {
- "type": 0,
- "value": " does not give a party.",
- },
- ],
- },
- "=1": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "host",
- },
- Object {
- "type": 0,
- "value": " invites ",
- },
- Object {
- "type": 1,
- "value": "guest",
- },
- Object {
- "type": 0,
- "value": " to their party.",
- },
- ],
- },
- "=2": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "host",
- },
- Object {
- "type": 0,
- "value": " invites ",
- },
- Object {
- "type": 1,
- "value": "guest",
- },
- Object {
- "type": 0,
- "value": " and one other person to their party.",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 1,
- "value": "host",
- },
- Object {
- "type": 0,
- "value": " invites ",
- },
- Object {
- "type": 1,
- "value": "guest",
- },
- Object {
- "type": 0,
- "value": " and ",
- },
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " other people to their party.",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "num_guests",
- },
- ],
- },
- },
- "type": 5,
- "value": "gender_of_host",
- },
-]
-`;
diff --git a/packages/intl-messageformat-parser/tests/__snapshots__/none_arg.test.ts.snap b/packages/intl-messageformat-parser/tests/__snapshots__/none_arg.test.ts.snap
deleted file mode 100644
index 8dc4c866e7..0000000000
--- a/packages/intl-messageformat-parser/tests/__snapshots__/none_arg.test.ts.snap
+++ /dev/null
@@ -1,32 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`trivial 1`] = `
-Array [
- Object {
- "type": 1,
- "value": "0",
- },
-]
-`;
-
-exports[`trivial 2`] = `
-Array [
- Object {
- "type": 1,
- "value": "arg",
- },
-]
-`;
-
-exports[`trivial 3`] = `
-Array [
- Object {
- "type": 0,
- "value": "hello ",
- },
- Object {
- "type": 1,
- "value": "name",
- },
-]
-`;
diff --git a/packages/intl-messageformat-parser/tests/__snapshots__/number_skeleton.test.ts.snap b/packages/intl-messageformat-parser/tests/__snapshots__/number_skeleton.test.ts.snap
deleted file mode 100644
index 2d9db0389f..0000000000
--- a/packages/intl-messageformat-parser/tests/__snapshots__/number_skeleton.test.ts.snap
+++ /dev/null
@@ -1,383 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`[parseNumberSkeleton] case: "% .##" 1`] = `
-Object {
- "maximumFractionDigits": 2,
- "style": "percent",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "%x100" 1`] = `
-Object {
- "scale": 100,
- "style": "percent",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "()!" 1`] = `
-Object {
- "currencySign": "accounting",
- "signDisplay": "always",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "()" 1`] = `
-Object {
- "currencySign": "accounting",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "()?" 1`] = `
-Object {
- "currencySign": "accounting",
- "signDisplay": "exceptZero",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "+!" 1`] = `
-Object {
- "signDisplay": "always",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "+?" 1`] = `
-Object {
- "signDisplay": "exceptZero",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "+_" 1`] = `
-Object {
- "signDisplay": "never",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "000" 1`] = `
-Object {
- "minimumIntegerDigits": 3,
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "E+!00" 1`] = `
-Object {
- "minimumIntegerDigits": 2,
- "notation": "scientific",
- "signDisplay": "always",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "E0" 1`] = `
-Object {
- "minimumIntegerDigits": 1,
- "notation": "scientific",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "EE+?000" 1`] = `
-Object {
- "minimumIntegerDigits": 3,
- "notation": "engineering",
- "signDisplay": "exceptZero",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "compact-long" 1`] = `
-Object {
- "compactDisplay": "long",
- "notation": "compact",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "compact-short" 1`] = `
-Object {
- "compactDisplay": "short",
- "notation": "compact",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "currency/CAD ." 1`] = `
-Object {
- "currency": "CAD",
- "maximumFractionDigits": 0,
- "style": "currency",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "currency/GBP .0*/@@@" 1`] = `
-Object {
- "currency": "GBP",
- "maximumSignificantDigits": 3,
- "minimumFractionDigits": 1,
- "minimumSignificantDigits": 3,
- "style": "currency",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "currency/GBP .00##/@@@ unit-width-full-name" 1`] = `
-Object {
- "currency": "GBP",
- "currencyDisplay": "name",
- "maximumFractionDigits": 4,
- "maximumSignificantDigits": 3,
- "minimumFractionDigits": 2,
- "minimumSignificantDigits": 3,
- "style": "currency",
- "unitDisplay": "long",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "currency/GBP .00##/@@@" 1`] = `
-Object {
- "currency": "GBP",
- "maximumFractionDigits": 4,
- "maximumSignificantDigits": 3,
- "minimumFractionDigits": 2,
- "minimumSignificantDigits": 3,
- "style": "currency",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "engineering" 1`] = `
-Object {
- "notation": "engineering",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "engineering/sign-except-zero" 1`] = `
-Object {
- "notation": "engineering",
- "signDisplay": "exceptZero",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "integer-width/*000" 1`] = `
-Object {
- "minimumIntegerDigits": 3,
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "measure-unit/length-meter .00##/@@@ unit-width-full-name" 1`] = `
-Object {
- "currencyDisplay": "name",
- "maximumFractionDigits": 4,
- "maximumSignificantDigits": 3,
- "minimumFractionDigits": 2,
- "minimumSignificantDigits": 3,
- "style": "unit",
- "unit": "meter",
- "unitDisplay": "long",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "measure-unit/length-meter .00##/@@@" 1`] = `
-Object {
- "maximumFractionDigits": 4,
- "maximumSignificantDigits": 3,
- "minimumFractionDigits": 2,
- "minimumSignificantDigits": 3,
- "style": "unit",
- "unit": "meter",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "notation-simple" 1`] = `
-Object {
- "notation": "standard",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "percent .##" 1`] = `
-Object {
- "maximumFractionDigits": 2,
- "style": "percent",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "percent .0###" 1`] = `
-Object {
- "maximumFractionDigits": 4,
- "minimumFractionDigits": 1,
- "style": "percent",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "percent .00/@##" 1`] = `
-Object {
- "maximumFractionDigits": 2,
- "maximumSignificantDigits": 3,
- "minimumFractionDigits": 2,
- "minimumSignificantDigits": 1,
- "style": "percent",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "percent .00/@@@" 1`] = `
-Object {
- "maximumFractionDigits": 2,
- "maximumSignificantDigits": 3,
- "minimumFractionDigits": 2,
- "minimumSignificantDigits": 3,
- "style": "percent",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "percent .00/@@@@*" 1`] = `
-Object {
- "maximumFractionDigits": 2,
- "minimumFractionDigits": 2,
- "style": "percent",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "percent .000*" 1`] = `
-Object {
- "minimumFractionDigits": 3,
- "style": "percent",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "percent scale/0.01" 1`] = `
-Object {
- "scale": 0.01,
- "style": "percent",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "scientific" 1`] = `
-Object {
- "notation": "scientific",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "scientific/+ee/sign-always" 1`] = `
-Object {
- "notation": "scientific",
- "signDisplay": "always",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "scientific/sign-always" 1`] = `
-Object {
- "notation": "scientific",
- "signDisplay": "always",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "sign-accounting" 1`] = `
-Object {
- "currencySign": "accounting",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "sign-accounting-always" 1`] = `
-Object {
- "currencySign": "accounting",
- "signDisplay": "always",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "sign-accounting-except-zero" 1`] = `
-Object {
- "currencySign": "accounting",
- "signDisplay": "exceptZero",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "sign-always" 1`] = `
-Object {
- "signDisplay": "always",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "sign-auto" 1`] = `
-Object {
- "signDisplay": "auto",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "sign-except-zero" 1`] = `
-Object {
- "signDisplay": "exceptZero",
-}
-`;
-
-exports[`[parseNumberSkeleton] case: "sign-never" 1`] = `
-Object {
- "signDisplay": "never",
-}
-`;
-
-exports[`case: "@@#" 1`] = `
-Array [
- Object {
- "style": Object {
- "parsedOptions": Object {},
- "tokens": Array [
- Object {
- "options": Array [],
- "stem": "@@#",
- },
- ],
- "type": 0,
- },
- "type": 2,
- "value": "0",
- },
-]
-`;
-
-exports[`case: "@@#" 2`] = `"{0, number, ::@@#}"`;
-
-exports[`case: "compact-short currency/GBP" 1`] = `
-Array [
- Object {
- "style": Object {
- "parsedOptions": Object {},
- "tokens": Array [
- Object {
- "options": Array [],
- "stem": "compact-short",
- },
- Object {
- "options": Array [
- "GBP",
- ],
- "stem": "currency",
- },
- ],
- "type": 0,
- },
- "type": 2,
- "value": "0",
- },
-]
-`;
-
-exports[`case: "compact-short currency/GBP" 2`] = `"{0, number, ::compact-short currency/GBP}"`;
-
-exports[`case: "currency/CAD unit-width-narrow" 1`] = `
-Array [
- Object {
- "style": Object {
- "parsedOptions": Object {},
- "tokens": Array [
- Object {
- "options": Array [
- "CAD",
- ],
- "stem": "currency",
- },
- Object {
- "options": Array [],
- "stem": "unit-width-narrow",
- },
- ],
- "type": 0,
- },
- "type": 2,
- "value": "0",
- },
-]
-`;
-
-exports[`case: "currency/CAD unit-width-narrow" 2`] = `"{0, number, ::currency/CAD unit-width-narrow}"`;
diff --git a/packages/intl-messageformat-parser/tests/__snapshots__/plural_arg.test.ts.snap b/packages/intl-messageformat-parser/tests/__snapshots__/plural_arg.test.ts.snap
deleted file mode 100644
index 05e50564f5..0000000000
--- a/packages/intl-messageformat-parser/tests/__snapshots__/plural_arg.test.ts.snap
+++ /dev/null
@@ -1,79 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`escaped nested message 1`] = `
-Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "item}",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "items}",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "itemCount",
- },
-]
-`;
-
-exports[`trivial 1`] = `
-Array [
- Object {
- "type": 0,
- "value": " Cart: ",
- },
- Object {
- "type": 1,
- "value": "itemCount",
- },
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "item",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "items",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "itemCount",
- },
-]
-`;
diff --git a/packages/intl-messageformat-parser/tests/__snapshots__/select_arg.test.ts.snap b/packages/intl-messageformat-parser/tests/__snapshots__/select_arg.test.ts.snap
deleted file mode 100644
index 397d4acd81..0000000000
--- a/packages/intl-messageformat-parser/tests/__snapshots__/select_arg.test.ts.snap
+++ /dev/null
@@ -1,95 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`nested arguments 1`] = `
-Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "options": Object {
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "No taxes apply.",
- },
- ],
- },
- "yes": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "An additional ",
- },
- Object {
- "style": "percent",
- "type": 2,
- "value": "taxRate",
- },
- Object {
- "type": 0,
- "value": " tax will be collected.",
- },
- ],
- },
- },
- "type": 5,
- "value": "taxableArea",
- },
- Object {
- "type": 0,
- "value": "
- ",
- },
-]
-`;
-
-exports[`trivial 1`] = `
-Array [
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "options": Object {
- "female": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "She",
- },
- ],
- },
- "male": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "He",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "They",
- },
- ],
- },
- },
- "type": 5,
- "value": "gender",
- },
- Object {
- "type": 0,
- "value": " will respond shortly.
- ",
- },
-]
-`;
diff --git a/packages/intl-messageformat-parser/tests/__snapshots__/simple_arg.test.ts.snap b/packages/intl-messageformat-parser/tests/__snapshots__/simple_arg.test.ts.snap
deleted file mode 100644
index 0d71da8bed..0000000000
--- a/packages/intl-messageformat-parser/tests/__snapshots__/simple_arg.test.ts.snap
+++ /dev/null
@@ -1,83 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`date & time arg 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "Your meeting is scheduled for the ",
- },
- Object {
- "style": null,
- "type": 3,
- "value": "dateVal",
- },
- Object {
- "type": 0,
- "value": " at ",
- },
- Object {
- "style": null,
- "type": 4,
- "value": "timeVal",
- },
-]
-`;
-
-exports[`date & time arg with style 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "Your meeting is scheduled for the ",
- },
- Object {
- "style": "long",
- "type": 3,
- "value": "dateVal",
- },
- Object {
- "type": 0,
- "value": " at ",
- },
- Object {
- "style": "short",
- "type": 4,
- "value": "timeVal",
- },
-]
-`;
-
-exports[`number arg 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "I have ",
- },
- Object {
- "style": null,
- "type": 2,
- "value": "numCats",
- },
- Object {
- "type": 0,
- "value": " cats.",
- },
-]
-`;
-
-exports[`number arg with style 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "Almost ",
- },
- Object {
- "style": "percent",
- "type": 2,
- "value": "pctBlack",
- },
- Object {
- "type": 0,
- "value": " of them are black.",
- },
-]
-`;
diff --git a/packages/intl-messageformat-parser/tests/__snapshots__/string_literal.test.ts.snap b/packages/intl-messageformat-parser/tests/__snapshots__/string_literal.test.ts.snap
deleted file mode 100644
index bd81851631..0000000000
--- a/packages/intl-messageformat-parser/tests/__snapshots__/string_literal.test.ts.snap
+++ /dev/null
@@ -1,195 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`apostrophe quote can be unclosed 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "a {a{ {}{}{} 'bb",
- },
-]
-`;
-
-exports[`apostrophe quote can be unclosed 2`] = `
-Array [
- Object {
- "type": 0,
- "value": "You have {count",
- },
-]
-`;
-
-exports[`apostrophe quote can be unclosed 3`] = `
-Array [
- Object {
- "type": 0,
- "value": "You have {count",
- },
-]
-`;
-
-exports[`apostrophe quote can be unclosed 4`] = `
-Array [
- Object {
- "type": 0,
- "value": "You have {count}",
- },
-]
-`;
-
-exports[`apostrophe quote can be unclosed 5`] = `
-Array [
- Object {
- "type": 0,
- "value": "You ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "worked for # hour",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "worked for # hours",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "count",
- },
- Object {
- "type": 0,
- "value": " today.",
- },
-]
-`;
-
-exports[`apostrophe quote can be unclosed 6`] = `
-Array [
- Object {
- "type": 0,
- "value": "You ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "one": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "worked for # hour} other {worked for ",
- },
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " hours",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "count",
- },
- Object {
- "type": 0,
- "value": " today.",
- },
-]
-`;
-
-exports[`does not start quoted text if apostrophe does not immediately precede a character 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "'aa'b'",
- },
-]
-`;
-
-exports[`does not start quoted text if apostrophe does not immediately precede a character 2`] = `
-Array [
- Object {
- "type": 0,
- "value": "I don't know",
- },
-]
-`;
-
-exports[`starts quoted text if apostrophe immediately precedes a character 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "{a'b}",
- },
-]
-`;
-
-exports[`starts quoted text if apostrophe immediately precedes a character 2`] = `
-Array [
- Object {
- "type": 0,
- "value": "}a'b{",
- },
-]
-`;
-
-exports[`starts quoted text if apostrophe immediately precedes a character 3`] = `
-Array [
- Object {
- "type": 0,
- "value": "aaa{",
- },
-]
-`;
-
-exports[`starts quoted text if apostrophe immediately precedes a character 4`] = `
-Array [
- Object {
- "type": 0,
- "value": "aaa}",
- },
-]
-`;
-
-exports[`treats double apostrophes as one apostrophe 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "a'b",
- },
-]
-`;
-
-exports[`unescaped string literals 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "}",
- },
-]
-`;
-
-exports[`unescaped string literals 2`] = `
-Array [
- Object {
- "type": 0,
- "value": "line1
- line2",
- },
-]
-`;
diff --git a/packages/intl-messageformat-parser/tests/__snapshots__/tag.test.ts.snap b/packages/intl-messageformat-parser/tests/__snapshots__/tag.test.ts.snap
deleted file mode 100644
index 472066ec32..0000000000
--- a/packages/intl-messageformat-parser/tests/__snapshots__/tag.test.ts.snap
+++ /dev/null
@@ -1,546 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`escaped multiple tags 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "I <3 cats. foo bar",
- },
-]
-`;
-
-exports[`escaped multiple tags with placeholder 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "I <3 cats. foo ",
- },
- Object {
- "type": 1,
- "value": "bar",
- },
- Object {
- "type": 0,
- "value": "",
- },
-]
-`;
-
-exports[`escaped tag with rich arg 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "I <3 cats.",
- },
-]
-`;
-
-exports[`greater than sign without escape 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "> ",
- },
- Object {
- "options": Object {
- "1": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "12",
- },
- ],
- },
- "2": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "6",
- },
- ],
- },
- "3": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "3",
- },
- ],
- },
- "4": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "2",
- },
- ],
- },
- "A": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "1",
- },
- ],
- },
- },
- "type": 5,
- "value": "level",
- },
- Object {
- "type": 0,
- "value": " hours",
- },
-]
-`;
-
-exports[`issue #1845: less than sign without escape 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "< ",
- },
- Object {
- "options": Object {
- "1": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "12",
- },
- ],
- },
- "2": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "6",
- },
- ],
- },
- "3": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "3",
- },
- ],
- },
- "4": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "2",
- },
- ],
- },
- "A": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "1",
- },
- ],
- },
- },
- "type": 5,
- "value": "level",
- },
- Object {
- "type": 0,
- "value": " hours",
- },
-]
-`;
-
-exports[`mismatched tag with ignoreTag 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "this is mismatch",
- },
-]
-`;
-
-exports[`nested tag 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "this is ",
- },
- Object {
- "children": Array [
- Object {
- "type": 0,
- "value": "nested ",
- },
- Object {
- "children": Array [
- Object {
- "type": 1,
- "value": "placeholder",
- },
- ],
- "type": 8,
- "value": "b",
- },
- ],
- "type": 8,
- "value": "a",
- },
-]
-`;
-
-exports[`nested tag with ignoreTag 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "this is nested ",
- },
- Object {
- "type": 1,
- "value": "placeholder",
- },
- Object {
- "type": 0,
- "value": "",
- },
-]
-`;
-
-exports[`self-closing tag 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "this is ",
- },
- Object {
- "type": 0,
- "value": "
",
- },
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "children": Array [
- Object {
- "type": 0,
- "value": "nested ",
- },
- Object {
- "children": Array [
- Object {
- "type": 1,
- "value": "placeholder",
- },
- ],
- "type": 8,
- "value": "b",
- },
- ],
- "type": 8,
- "value": "a",
- },
-]
-`;
-
-exports[`self-closing tag with ignoreTag 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "this is
nested ",
- },
- Object {
- "type": 1,
- "value": "placeholder",
- },
- Object {
- "type": 0,
- "value": "",
- },
-]
-`;
-
-exports[`tag in plural 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "You have ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "=1": Object {
- "location": undefined,
- "value": Array [
- Object {
- "children": Array [
- Object {
- "type": 0,
- "value": "1",
- },
- ],
- "type": 8,
- "value": "b",
- },
- Object {
- "type": 0,
- "value": " Message",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "children": Array [
- Object {
- "type": 7,
- },
- ],
- "type": 8,
- "value": "b",
- },
- Object {
- "type": 0,
- "value": " Messages",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "count",
- },
-]
-`;
-
-exports[`tag in plural with ignoreTag 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "You have ",
- },
- Object {
- "offset": 0,
- "options": Object {
- "=1": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "1 Message",
- },
- ],
- },
- "other": Object {
- "location": undefined,
- "value": Array [
- Object {
- "type": 0,
- "value": "",
- },
- Object {
- "type": 7,
- },
- Object {
- "type": 0,
- "value": " Messages",
- },
- ],
- },
- },
- "pluralType": "cardinal",
- "type": 6,
- "value": "count",
- },
-]
-`;
-
-exports[`tag with dash 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "this is ",
- },
- Object {
- "type": 0,
- "value": "
",
- },
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "children": Array [
- Object {
- "type": 0,
- "value": "nested ",
- },
- Object {
- "children": Array [
- Object {
- "type": 1,
- "value": "placeholder",
- },
- ],
- "type": 8,
- "value": "b",
- },
- ],
- "type": 8,
- "value": "dash-tag",
- },
-]
-`;
-
-exports[`tag with dash with ignoreTag 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "this is
nested ",
- },
- Object {
- "type": 1,
- "value": "placeholder",
- },
- Object {
- "type": 0,
- "value": "",
- },
-]
-`;
-
-exports[`tag with number arg 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "I have ",
- },
- Object {
- "children": Array [
- Object {
- "style": null,
- "type": 2,
- "value": "numCats",
- },
- ],
- "type": 8,
- "value": "foo",
- },
- Object {
- "type": 0,
- "value": " cats.",
- },
-]
-`;
-
-exports[`tag with number arg with ignoreTag 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "I have ",
- },
- Object {
- "style": null,
- "type": 2,
- "value": "numCats",
- },
- Object {
- "type": 0,
- "value": " cats.",
- },
-]
-`;
-
-exports[`tag with rich arg 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "I ",
- },
- Object {
- "children": Array [
- Object {
- "type": 0,
- "value": "have",
- },
- ],
- "type": 8,
- "value": "b",
- },
- Object {
- "type": 0,
- "value": " ",
- },
- Object {
- "children": Array [
- Object {
- "style": null,
- "type": 2,
- "value": "numCats",
- },
- Object {
- "type": 0,
- "value": " some string ",
- },
- Object {
- "type": 1,
- "value": "placeholder",
- },
- ],
- "type": 8,
- "value": "foo",
- },
- Object {
- "type": 0,
- "value": " cats.",
- },
-]
-`;
-
-exports[`tag with rich arg with ignoreTag 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "I have ",
- },
- Object {
- "style": null,
- "type": 2,
- "value": "numCats",
- },
- Object {
- "type": 0,
- "value": " some string ",
- },
- Object {
- "type": 1,
- "value": "placeholder",
- },
- Object {
- "type": 0,
- "value": " cats.",
- },
-]
-`;
-
-exports[`unescaped left angle bracket 1`] = `
-Array [
- Object {
- "type": 0,
- "value": "I <3 cats.",
- },
-]
-`;
diff --git a/packages/intl-messageformat-parser/tests/arg_style.test.ts b/packages/intl-messageformat-parser/tests/arg_style.test.ts
deleted file mode 100644
index 398f99c757..0000000000
--- a/packages/intl-messageformat-parser/tests/arg_style.test.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import {pegParse} from '../src/parser'
-import {printAST} from '../src/printer'
-
-test.each([
- `{0,date,y-M-d HH:mm:ss}`,
- `{0,number,y-M-d HH:mm:ss}`,
- `{0,date,y-M-d HH:mm:ss zzzz}`,
- `{0,number,y-M-d HH:mm:ss zzzz}`,
- `{0,date,y-M-d,HH:mm:ss,zzzz}`,
- `{0,number,y-M-d,HH:mm:ss,zzzz}`,
- `{0,number,'{}'}`,
- `{0,number,''}`,
-])('argStyleText test case: %p', testCase => {
- const ast = pegParse(testCase)
- expect(ast).toMatchSnapshot()
- expect(printAST(ast)).toMatchSnapshot()
-})
diff --git a/packages/intl-messageformat-parser/tests/benchmark.js b/packages/intl-messageformat-parser/tests/benchmark.js
deleted file mode 100644
index 4f0d3b2bcd..0000000000
--- a/packages/intl-messageformat-parser/tests/benchmark.js
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env node
-'use strict'
-const benchmark = require('benchmark')
-var parser = require('../')
-
-const complexMsg =
- '' +
- '{gender_of_host, select, ' +
- 'female {' +
- '{num_guests, plural, offset:1 ' +
- '=0 {{host} does not give a party.}' +
- '=1 {{host} invites {guest} to her party.}' +
- '=2 {{host} invites {guest} and one other person to her party.}' +
- 'other {{host} invites {guest} and # other people to her party.}}}' +
- 'male {' +
- '{num_guests, plural, offset:1 ' +
- '=0 {{host} does not give a party.}' +
- '=1 {{host} invites {guest} to his party.}' +
- '=2 {{host} invites {guest} and one other person to his party.}' +
- 'other {{host} invites {guest} and # other people to his party.}}}' +
- 'other {' +
- '{num_guests, plural, offset:1 ' +
- '=0 {{host} does not give a party.}' +
- '=1 {{host} invites {guest} to their party.}' +
- '=2 {{host} invites {guest} and one other person to their party.}' +
- 'other {{host} invites {guest} and # other people to their party.}}}}'
-
-const normalMsg =
- '' +
- 'Yo, {firstName} {lastName} has ' +
- '{numBooks, number, integer} ' +
- '{numBooks, plural, ' +
- 'one {book} ' +
- 'other {books}}.'
-
-const simpleMsg = 'Hello, {name}!'
-
-const stringMsg = 'Hello, world!'
-
-console.log(
- 'complex_msg AST length',
- JSON.stringify(parser.parse(complexMsg)).length
-)
-console.log(
- 'normal_msg AST length',
- JSON.stringify(parser.parse(normalMsg)).length
-)
-console.log(
- 'simple_msg AST length',
- JSON.stringify(parser.parse(simpleMsg)).length
-)
-console.log(
- 'string_msg AST length',
- JSON.stringify(parser.parse(stringMsg)).length
-)
-
-new benchmark.Suite()
- .add('complex_msg', () => parser.parse(complexMsg))
- .add('normal_msg', () => parser.parse(normalMsg))
- .add('simple_msg', () => parser.parse(simpleMsg))
- .add('string_msg', () => parser.parse(stringMsg))
- .on('cycle', function (event) {
- console.log(String(event.target))
- })
- .run()
diff --git a/packages/intl-messageformat-parser/tests/date_skeleton.test.ts b/packages/intl-messageformat-parser/tests/date_skeleton.test.ts
deleted file mode 100644
index 11ab959de4..0000000000
--- a/packages/intl-messageformat-parser/tests/date_skeleton.test.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import {pegParse} from '../src/parser'
-import {printAST} from '../src/printer'
-import {parseDateTimeSkeleton} from '../src/skeleton'
-
-test.each([
- `yyyy.MM.dd G 'at' HH:mm:ss vvvv`,
- `EEE, MMM d, ''yy`,
- `h:mm a`,
- ``,
-])('case: %p', skeleton => {
- const ast = pegParse(`{0, date, ::${skeleton}}`)
- expect(ast).toMatchSnapshot()
- expect(printAST(ast)).toMatchSnapshot()
-})
-
-test.each([
- `yyyy.MM.dd G 'at' HH:mm:ss zzzz`,
- `EEE, MMM d, ''yy`,
- `h:mm a`,
- ``,
-])('case: %p', skeleton => {
- expect(parseDateTimeSkeleton(skeleton)).toMatchSnapshot()
-})
diff --git a/packages/intl-messageformat-parser/tests/error.test.ts b/packages/intl-messageformat-parser/tests/error.test.ts
deleted file mode 100644
index ce388426a5..0000000000
--- a/packages/intl-messageformat-parser/tests/error.test.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import {pegParse} from '../'
-describe('error', function () {
- ;[
- 'You have {count, plural, one {# hot dog} one {# hamburger} one {# sandwich} other {# snacks}} in your lunch bag.',
- 'You have {count, select, one {# hot dog} one {# hamburger} one {# sandwich} other {# snacks}} in your lunch bag.',
- ].forEach(mess => {
- it(`show throw SyntaxError '${mess}'`, function () {
- expect(() => pegParse(mess)).toThrowError(/Duplicate/)
- })
- })
-})
diff --git a/packages/intl-messageformat-parser/tests/index.test.ts b/packages/intl-messageformat-parser/tests/index.test.ts
deleted file mode 100644
index adc0492aca..0000000000
--- a/packages/intl-messageformat-parser/tests/index.test.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-import {pegParse, ParseOptions} from '../'
-import {printAST} from '../src/printer'
-
-function allTests(opts?: ParseOptions) {
- ;[
- 'Hello, World!',
- 'Hello, {name}!',
- 'My name is {FIRST} {LAST}, age {age, number}, time {time, time}, date {date, date}.',
- '{num, number, percent}',
- '{count, time}',
- '{numPhotos, plural, =0{no photos} =1{one photo} other{# photos}}',
- 'Foo {var1, plural, =0{# var1} other{{var2, plural, =0{# var2} other{# var2-other}} # other}}',
- '{floor, selectordinal, =0{ground} one{#st} two{#nd} few{#rd} other{#th}} floor',
- '{gender, select, female {woman} male {man} other {person}}',
- ' some random test ',
- '{ num , number,percent }',
- '{c, plural, =1 { {text} project} other { {text} projects}}',
- '{c, plural, offset:-2 =-1 { {text} project} other { {text} projects}}', // negative
- '{c, plural, =99 { {text} project} other { {text} projects}}',
- `'{'`,
- `'}'`,
- // Escaping "#" needs to be special-cased so it remains escaped so
- // the runtime doesn't replace it when in a `pluralFormat` option.
- `'#'`,
- /**
- * @see https://unicode-org.github.io/icu/userguide/format_parse/messages/#quotingescaping
- * @see https://github.com/formatjs/formatjs/issues/97
- */
- "This '{isn''t}' obvious",
- "'{name}'",
- 'this is {count,plural,offset:1 one{{count, number} dog} other{{count, number} dogs}}',
- `{type, select,
- drop {
- {units, plural,
- one {# drop}
- other {# drops}
- }
- }
- teaspoon {
- {units, plural,
- one {# teaspoon}
- other {# teaspoons}
- }
- }
- tablespoon {
- {units, plural,
- one {# tablespoon}
- other {# tablespoons}
- }
- }
- }`,
- '{howMany, select,\
- one {{actor1}}\
- other {\
- {nExtraActors, plural,\
- one {{actor1} and {actor2}}\
- other {{actor1} and {nExtraActors} others}\
- }}\
- } shared this file.',
- ].forEach(mess => {
- const ast = pegParse(mess, opts)
- it(`can pegParse '${mess}'`, function () {
- expect(ast).toMatchSnapshot()
- })
- it(`can print AST from '${mess}'`, function () {
- expect(printAST(ast)).toMatchSnapshot()
- })
- })
-}
-
-describe('pegParse()', function () {
- allTests()
-})
-
-describe('pegParse({ captureLocation: true })', function () {
- allTests()
-})
diff --git a/packages/intl-messageformat-parser/tests/nested.test.ts b/packages/intl-messageformat-parser/tests/nested.test.ts
deleted file mode 100644
index e44ce3ab8d..0000000000
--- a/packages/intl-messageformat-parser/tests/nested.test.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import {pegParse} from '../src/parser'
-
-test('plural arg nested inside select arg', () => {
- expect(
- pegParse(`\
- {gender_of_host, select,
- female {
- {num_guests, plural, offset:1
- =0 {{host} does not give a party.}
- =1 {{host} invites {guest} to her party.}
- =2 {{host} invites {guest} and one other person to her party.}
- other {{host} invites {guest} and # other people to her party.}}}
- male {
- {num_guests, plural, offset:1
- =0 {{host} does not give a party.}
- =1 {{host} invites {guest} to his party.}
- =2 {{host} invites {guest} and one other person to his party.}
- other {{host} invites {guest} and # other people to his party.}}}
- other {
- {num_guests, plural, offset:1
- =0 {{host} does not give a party.}
- =1 {{host} invites {guest} to their party.}
- =2 {{host} invites {guest} and one other person to their party.}
- other {{host} invites {guest} and # other people to their party.}}}}`)
- ).toMatchSnapshot()
-})
diff --git a/packages/intl-messageformat-parser/tests/none_arg.test.ts b/packages/intl-messageformat-parser/tests/none_arg.test.ts
deleted file mode 100644
index 54dd18fccb..0000000000
--- a/packages/intl-messageformat-parser/tests/none_arg.test.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import {pegParse} from '../src/parser'
-
-test('trivial', () => {
- expect(pegParse('{0}')).toMatchSnapshot()
- expect(pegParse('{arg}')).toMatchSnapshot()
- expect(pegParse('hello {name}')).toMatchSnapshot()
-})
diff --git a/packages/intl-messageformat-parser/tests/number_skeleton.test.ts b/packages/intl-messageformat-parser/tests/number_skeleton.test.ts
deleted file mode 100644
index 91b2f16e98..0000000000
--- a/packages/intl-messageformat-parser/tests/number_skeleton.test.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-import {pegParse} from '../src/parser'
-import {printAST} from '../src/printer'
-import {isNumberElement, TYPE, isNumberSkeleton} from '../src/types'
-import {parseNumberSkeleton} from '../src/skeleton'
-
-test.each([
- `compact-short currency/GBP`,
- `@@#`,
- `currency/CAD unit-width-narrow`,
-])('case: %p', skeleton => {
- const ast = pegParse(`{0, number, ::${skeleton}}`)
- expect(ast).toMatchSnapshot()
- expect(printAST(ast)).toMatchSnapshot()
-})
-
-test.each([
- 'percent .##',
- '% .##',
- 'percent .000*',
- 'percent .0###',
- 'percent .00/@##',
- 'percent .00/@@@',
- 'percent .00/@@@@*',
- 'percent scale/0.01',
- 'currency/CAD .',
- 'currency/GBP .0*/@@@',
- 'currency/GBP .00##/@@@',
- 'currency/GBP .00##/@@@ unit-width-full-name',
- 'measure-unit/length-meter .00##/@@@',
- 'measure-unit/length-meter .00##/@@@ unit-width-full-name',
- 'compact-short',
- 'compact-long',
- 'scientific',
- 'scientific/sign-always',
- 'scientific/+ee/sign-always',
- 'engineering',
- 'engineering/sign-except-zero',
- 'notation-simple',
- 'sign-auto',
- 'sign-always',
- '+!',
- 'sign-never',
- '+_',
- 'sign-accounting',
- '()',
- 'sign-accounting-always',
- '()!',
- 'sign-except-zero',
- '+?',
- 'sign-accounting-except-zero',
- '()?',
- '000',
- 'integer-width/*000',
- 'E0',
- 'E+!00',
- 'EE+?000',
- '%x100',
-])('[parseNumberSkeleton] case: %p', skeleton => {
- const ast = pegParse(`{0, number, ::${skeleton}}`)
- const el = ast[0]
- if (!isNumberElement(el)) {
- throw expect(el.type).toEqual(TYPE.number)
- }
- if (!isNumberSkeleton(el.style)) {
- throw 'element style should be parsed as number skeleton'
- }
- expect(parseNumberSkeleton(el.style.tokens)).toMatchSnapshot()
-})
diff --git a/packages/intl-messageformat-parser/tests/plural_arg.test.ts b/packages/intl-messageformat-parser/tests/plural_arg.test.ts
deleted file mode 100644
index 8603d24937..0000000000
--- a/packages/intl-messageformat-parser/tests/plural_arg.test.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import {pegParse} from '../src/parser'
-
-test('trivial', () => {
- expect(
- pegParse(`\
- Cart: {itemCount} {itemCount, plural,
- one {item}
- other {items}
- }`)
- ).toMatchSnapshot()
- expect(
- pegParse(`\
- You have {itemCount, plural,
- =0 {no items}
- one {1 item}
- other {{itemCount} items}
- }.`)
- )
-})
-
-test('escaped nested message', () => {
- expect(
- pegParse(`\
- {itemCount, plural,
- one {item'}'}
- other {items'}'}
- }`)
- ).toMatchSnapshot()
-})
diff --git a/packages/intl-messageformat-parser/tests/select_arg.test.ts b/packages/intl-messageformat-parser/tests/select_arg.test.ts
deleted file mode 100644
index 23ed95e5ce..0000000000
--- a/packages/intl-messageformat-parser/tests/select_arg.test.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import {pegParse} from '../src/parser'
-
-test('trivial', () => {
- expect(
- pegParse(`\
- {gender, select,
- male {He}
- female {She}
- other {They}
- } will respond shortly.
- `)
- ).toMatchSnapshot()
-})
-
-test('nested arguments', () => {
- expect(
- pegParse(`\
- {taxableArea, select,
- yes {An additional {taxRate, number, percent} tax will be collected.}
- other {No taxes apply.}
- }
- `)
- ).toMatchSnapshot()
-})
diff --git a/packages/intl-messageformat-parser/tests/simple_arg.test.ts b/packages/intl-messageformat-parser/tests/simple_arg.test.ts
deleted file mode 100644
index 5b6b1a4901..0000000000
--- a/packages/intl-messageformat-parser/tests/simple_arg.test.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import {pegParse} from '../src/parser'
-
-test('number arg', () => {
- expect(pegParse('I have {numCats, number} cats.')).toMatchSnapshot()
-})
-
-test('number arg with style', () => {
- expect(
- pegParse('Almost {pctBlack, number, percent} of them are black.')
- ).toMatchSnapshot()
-})
-
-test('date & time arg', () => {
- expect(
- pegParse(
- 'Your meeting is scheduled for the {dateVal, date} at {timeVal, time}'
- )
- ).toMatchSnapshot()
-})
-
-test('date & time arg with style', () => {
- expect(
- pegParse(
- 'Your meeting is scheduled for the {dateVal, date, long} at {timeVal, time, short}'
- )
- ).toMatchSnapshot()
-})
diff --git a/packages/intl-messageformat-parser/tests/string_literal.test.ts b/packages/intl-messageformat-parser/tests/string_literal.test.ts
deleted file mode 100644
index c18a9e5ee4..0000000000
--- a/packages/intl-messageformat-parser/tests/string_literal.test.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-import {pegParse} from '../src/parser'
-
-test('unescaped string literals', () => {
- expect(pegParse('}')).toMatchSnapshot()
- expect(pegParse('line1\n line2')).toMatchSnapshot()
-})
-
-test('treats double apostrophes as one apostrophe', () => {
- expect(pegParse(`a''b`)).toMatchSnapshot()
-})
-
-test('starts quoted text if apostrophe immediately precedes a character', () => {
- expect(pegParse(`'{a''b}'`)).toMatchSnapshot()
- expect(pegParse(`'}a''b{'`)).toMatchSnapshot()
- expect(pegParse(`aaa'{'`)).toMatchSnapshot()
- expect(pegParse(`aaa'}'`)).toMatchSnapshot()
-})
-
-test('does not start quoted text if apostrophe does not immediately precede a character', () => {
- expect(pegParse(`'aa''b'`)).toMatchSnapshot()
- expect(pegParse(`I don't know`)).toMatchSnapshot()
-})
-
-test('apostrophe quote can be unclosed', () => {
- // Substring starting at th apostrophe are all escaped because the quote did not close
- expect(pegParse(`a '{a{ {}{}{} ''bb`)).toMatchSnapshot()
- // The apostrophe here does not start a quote because it is not followed by `{` or `}`,
- // so the `{}` is invalid syntax.
- expect(() => pegParse(`a 'a {}{}`)).toThrow()
- // The last apostrophe ends the escaping, therefore the last `{}` is invalid syntax.
- expect(() => pegParse(`a '{a{ {}{}{}}}''' \n {}`)).toThrow()
- expect(pegParse("You have '{count'")).toMatchSnapshot()
- expect(pegParse("You have '{count")).toMatchSnapshot()
- expect(pegParse("You have '{count}")).toMatchSnapshot()
- expect(
- pegParse(
- "You {count, plural, one {worked for '#' hour} other {worked for '#' hours}} today."
- )
- ).toMatchSnapshot()
- expect(
- // '# hour} other {worked for ' is quoted.
- pegParse(
- "You {count, plural, one {worked for '# hour} other {worked for '# hours}} today."
- )
- ).toMatchSnapshot()
-})
diff --git a/packages/intl-messageformat-parser/tests/tag.test.ts b/packages/intl-messageformat-parser/tests/tag.test.ts
deleted file mode 100644
index 95741ac8b0..0000000000
--- a/packages/intl-messageformat-parser/tests/tag.test.ts
+++ /dev/null
@@ -1,161 +0,0 @@
-import {pegParse as _pegParse, IParseOptions} from '../src/parser'
-
-// Make it easier to figure out the error location
-function pegParse(
- source: string,
- options?: IParseOptions
-): ReturnType {
- try {
- return _pegParse(source, options)
- } catch (err) {
- if (err.location) {
- const {start, end} = err.location
- err.message = `(${start.line}:${start.column} - ${end.line}:${end.column}) ${err.message}`
- }
- throw err
- }
-}
-
-test('tag with number arg', () => {
- expect(
- pegParse('I have {numCats, number} cats.')
- ).toMatchSnapshot()
-})
-
-test('tag with number arg with ignoreTag', () => {
- expect(
- pegParse('I have {numCats, number} cats.', {ignoreTag: true})
- ).toMatchSnapshot()
-})
-
-test('tag with rich arg', () => {
- expect(
- pegParse(
- 'I have {numCats, number} some string {placeholder} cats.'
- )
- ).toMatchSnapshot()
-})
-
-test('tag with rich arg with ignoreTag', () => {
- expect(
- pegParse(
- 'I have {numCats, number} some string {placeholder} cats.',
- {ignoreTag: true}
- )
- ).toMatchSnapshot()
-})
-
-test('escaped tag with rich arg', () => {
- expect(pegParse("I '<3 cats.")).toMatchSnapshot()
-})
-
-test('unescaped left angle bracket', () => {
- expect(pegParse('I <3 cats.')).toMatchSnapshot()
-})
-
-test('escaped multiple tags', () => {
- expect(pegParse("I '<'3 cats. 'foo' 'bar'")).toMatchSnapshot()
-})
-
-test('escaped multiple tags with placeholder', () => {
- expect(
- pegParse("I '<'3 cats. 'foo' ''{bar}''")
- ).toMatchSnapshot()
-})
-
-test('mismatched tag', function () {
- expect(() => pegParse('this is mismatch')).toThrowError(/Mismatch/)
-})
-
-test('mismatched tag with ignoreTag', function () {
- expect(
- pegParse('this is mismatch', {ignoreTag: true})
- ).toMatchSnapshot()
-})
-
-test('nested tag', function () {
- expect(
- pegParse('this is nested {placeholder}')
- ).toMatchSnapshot()
-})
-
-test('nested tag with ignoreTag', function () {
- expect(
- pegParse('this is nested {placeholder}', {ignoreTag: true})
- ).toMatchSnapshot()
-})
-
-test('tag in plural', function () {
- expect(
- pegParse(
- 'You have {count, plural, =1 {1 Message} other {# Messages}}'
- )
- ).toMatchSnapshot()
-})
-
-test('tag in plural with ignoreTag', function () {
- expect(
- pegParse(
- 'You have {count, plural, =1 {1 Message} other {# Messages}}',
- {ignoreTag: true}
- )
- ).toMatchSnapshot()
-})
-
-test('self-closing tag', function () {
- expect(
- pegParse('this is
nested {placeholder}')
- ).toMatchSnapshot()
-})
-
-test('self-closing tag with ignoreTag', function () {
- expect(
- pegParse('this is
nested {placeholder}', {
- ignoreTag: true,
- })
- ).toMatchSnapshot()
-})
-
-test('tag with dash', function () {
- expect(
- pegParse('this is
nested {placeholder}')
- ).toMatchSnapshot()
-})
-
-test('tag with dash with ignoreTag', function () {
- expect(
- pegParse('this is
nested {placeholder}', {
- ignoreTag: true,
- })
- ).toMatchSnapshot()
-})
-
-// https://github.com/formatjs/formatjs/issues/1845
-test('issue #1845: less than sign without escape', () => {
- expect(
- pegParse('< {level, select, A {1} 4 {2} 3 {3} 2{6} 1{12}} hours')
- ).toMatchSnapshot()
-})
-
-// https://github.com/formatjs/formatjs/issues/1845
-test('greater than sign without escape', () => {
- expect(
- pegParse('> {level, select, A {1} 4 {2} 3 {3} 2{6} 1{12}} hours')
- ).toMatchSnapshot()
-})
-
-test('unmatched closing tag', () => {
- expect(() => pegParse('a ')).toThrow()
-})
-
-test('unclosed opening tag', () => {
- expect(() => pegParse('a')).toThrow()
-})
-
-test('unclosed opening tag with nested messages', () => {
- expect(() =>
- pegParse(`
- You have {count, plural, =1 { one message} other {# messages}}.
- `)
- ).toThrow()
-})
diff --git a/packages/intl-messageformat-parser/tests/unicode_whitespace.test.ts b/packages/intl-messageformat-parser/tests/unicode_whitespace.test.ts
deleted file mode 100644
index 997aa539fe..0000000000
--- a/packages/intl-messageformat-parser/tests/unicode_whitespace.test.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import {parse, TYPE, SelectElement} from '../'
-
-test('it skips unicode no-break space (U+00A0)', () => {
- const tree = parse(`{gender, select,
- \u00a0male {
- {He}}
- \u00a0female {
- {She}}
- \u00a0other{
- {They}}}
- `)
- const selectElement = tree[0] as SelectElement
- expect(selectElement.type).toBe(TYPE.select)
- expect(Object.keys(selectElement.options)).toEqual([
- 'male',
- 'female',
- 'other',
- ])
-})
diff --git a/packages/intl-messageformat-parser/tools/build.js b/packages/intl-messageformat-parser/tools/build.js
deleted file mode 100755
index acc79c7f9d..0000000000
--- a/packages/intl-messageformat-parser/tools/build.js
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/env node
-const peg = require('pegjs')
-const tspegjs = require('ts-pegjs')
-const fs = require('fs')
-const {outputFileSync} = require('fs-extra')
-const minimist = require('minimist')
-
-function main({out, input}) {
- // TS
- const srcString = peg.generate(fs.readFileSync(input, 'utf-8'), {
- plugins: [tspegjs],
- output: 'source',
- trace: false,
- tspegjs: {
- customHeader: `
-// @generated
-import {
- ArgumentElement,
- DateElement,
- DateTimeSkeleton,
- LiteralElement,
- MessageFormatElement,
- NumberElement,
- NumberSkeleton,
- PluralElement,
- PluralOrSelectOption,
- PoundElement,
- SelectElement,
- SKELETON_TYPE,
- TagElement,
- TimeElement,
- TYPE,
-} from './types'
-import {parseDateTimeSkeleton, parseNumberSkeleton} from './skeleton'`,
- },
- returnTypes: {
- argument: 'string',
- ws: 'string',
- digit: 'string',
- hexDigit: 'string',
- quoteEscapedChar: 'string',
- apostrophe: 'string',
- escape: 'string',
- char: 'string',
- chars: 'string',
- varName: 'string',
- number: 'number',
- start: 'MessageFormatElement[]',
- message: 'MessageFormatElement[]',
- literalElement: 'LiteralElement',
- argumentElement: 'ArgumentElement',
- tagElement: 'TagElement',
- selectElement: 'SelectElement',
- pluralElement: 'PluralElement',
- poundElement: 'PoundElement',
- selectOption: 'PluralOrSelectOption',
- pluralOption: 'PluralOrSelectOption',
- numberSkeleton: 'NumberSkeleton',
- dateTimeSkeleton: 'DateTimeSkeleton',
- numberArgStyle: 'string | NumberSkeleton',
- dateTimeArgStyle: 'string | DateTimeSkeleton',
- simpleFormatElement: `
-| NumberElement
-| DateElement
-| TimeElement
-`,
- },
- })
-
- const REGEX = /ParseFunction = \((.*?)\) => (any);/g
- const PARSE_EXPORT = /export const parse:/g
- outputFileSync(
- out,
- '// @ts-nocheck\n' +
- srcString
- .replace(REGEX, 'ParseFunction = ($1) => MessageFormatElement[];')
- .replace(PARSE_EXPORT, 'export const pegParse:')
- )
-}
-
-if (require.main === module) {
- main(minimist(process.argv))
-}
diff --git a/packages/intl-messageformat-parser/tsconfig.json b/packages/intl-messageformat-parser/tsconfig.json
deleted file mode 100644
index 10b408242c..0000000000
--- a/packages/intl-messageformat-parser/tsconfig.json
+++ /dev/null
@@ -1,5 +0,0 @@
-// @generated
-{
- // This is purely for IDE, not for compilation
- "extends": "../../tsconfig.json"
-}