From d0d4cbf5211df230d9d20e28b36c6db96b07d0d2 Mon Sep 17 00:00:00 2001 From: richarddavison <89518095+richarddavison@users.noreply.github.com> Date: Fri, 8 Mar 2024 14:29:34 +0100 Subject: [PATCH] Add back disabled unit tests (#254) * Add back disabled unit tests * Run prettier on make fix * Don't minify e2e tests --- .fleet/settings.json | 4 +- .github/pull_request_template.md | 4 +- .vscode/launch.json | 2 +- .vscode/settings.json | 2 +- .yarnrc.yml | 2 +- API.md | 59 +- CHANGELOG.md | 10 +- CODE_OF_CONDUCT.md | 3 +- CONTRIBUTING.md | 10 +- GOVERNANCE.md | 34 +- MAINTAINERS.md | 21 +- Makefile | 8 +- README.md | 180 +- benchmarks/v8-v7/base.js | 82 +- benchmarks/v8-v7/crypto.js | 1622 +-- benchmarks/v8-v7/deltablue.js | 232 +- benchmarks/v8-v7/earley-boyer.js | 9919 ++++++++++++----- benchmarks/v8-v7/navier-stokes.js | 640 +- benchmarks/v8-v7/raytrace.js | 1459 +-- benchmarks/v8-v7/regexp.js | 2566 +++-- benchmarks/v8-v7/richards.js | 63 +- benchmarks/v8-v7/splay.js | 65 +- build.mjs | 11 +- example/functions/src/react/CreateTodo.tsx | 31 +- example/functions/src/react/index.html | 2 +- example/functions/src/v2.js | 34 +- example/functions/src/v3-lib.mjs | 26 +- example/functions/src/v3-mono.mjs | 30 +- example/functions/src/v3.mjs | 34 +- example/llrt-sam-container-image/README.md | 30 +- example/llrt-sam/README.md | 39 +- example/llrt-sam/hello-world/app.ts | 38 +- example/llrt-sam/hello-world/tsconfig.json | 28 +- example/llrt-sam/template.yaml | 9 +- fixtures/fs/readdir/readdir.js | 4 +- fixtures/fs/readdir/recursive/readdir.js | 4 +- fixtures/throw.js | 2 +- package.json | 4 + shims/lru-cache.js | 56 +- shims/util-utf8.js | 22 +- .../@llrt/expect/jest-asymmetric-matchers.ts | 319 +- src/js/@llrt/expect/jest-expect.ts | 1138 +- src/js/@llrt/expect/jest-utils.ts | 537 +- src/js/@llrt/expect/stringify.ts | 32 +- src/js/@llrt/test.ts | 20 +- .../e2e/IntegTestResourcesStack.template.yml | 4 +- tests/e2e/README.md | 11 +- tests/e2e/cognito_identity.e2e.test.ts | 10 +- tests/e2e/dynamodb.e2e.test.ts | 27 +- tests/e2e/s3.e2e.test.ts | 475 +- tests/unit/fs.test.ts | 43 +- tests/unit/jest-expect.test.ts | 712 +- vitest.config.mjs | 14 +- 53 files changed, 12786 insertions(+), 7947 deletions(-) diff --git a/.fleet/settings.json b/.fleet/settings.json index 729391663f..f6683a5ccb 100644 --- a/.fleet/settings.json +++ b/.fleet/settings.json @@ -1,3 +1,3 @@ { - "backend.maxHeapSizeMb": 2048 -} \ No newline at end of file + "backend.maxHeapSizeMb": 2048 +} diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6131e0e190..be0e483eaf 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -9,8 +9,8 @@ ### Checklist - [ ] Created unit tests in `tests/unit` and/or in Rust for my feature if needed -- [ ] Ran `make fix` to format and apply Clippy auto fixes +- [ ] Ran `make fix` to format JS and apply Clippy auto fixes - [ ] Made sure my code didn't add any additional warnings: `make check` - [ ] Updated documentation if needed ([API.md](API.md)/[README.md](README.md)/Other) -*By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.* \ No newline at end of file +_By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ diff --git a/.vscode/launch.json b/.vscode/launch.json index 958756ad9f..3482bf3032 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -55,7 +55,7 @@ "AWS_SECRET_ACCESS_KEY": "", "AWS_SESSION_TOKEN": "" }, - "args": ["test","-d","bundle"], + "args": ["test", "-d", "bundle"], "cwd": "${workspaceFolder}" } ] diff --git a/.vscode/settings.json b/.vscode/settings.json index 6fae703fa2..d7243f640b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "cSpell.words": ["Abortable", "rquickjs","LLRT","llrt"], + "cSpell.words": ["Abortable", "rquickjs", "LLRT", "llrt"], "cmake.configureOnOpen": false, "rust-analyzer.showUnlinkedFileNotification": false } diff --git a/.yarnrc.yml b/.yarnrc.yml index 8b757b29a1..3186f3f079 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1 +1 @@ -nodeLinker: node-modules \ No newline at end of file +nodeLinker: node-modules diff --git a/API.md b/API.md index 3cc09cd84d..be666551cf 100644 --- a/API.md +++ b/API.md @@ -1,6 +1,6 @@ # API documentation -> [!NOTE] +> [!NOTE] > The long term goal for LLRT is to become [Winter CG compliant](https://github.com/wintercg/admin/blob/main/proposals.md). Not every API from Node.js will be supported. ## buffer @@ -17,8 +17,7 @@ Everything else inherited from [Uint8Array](https://developer.mozilla.org/en-US/ ## child_process -> [!WARNING] -> `spawn` uses native streams that is not 100% compatible with the Node.js Streams API. +> [!WARNING] > `spawn` uses native streams that is not 100% compatible with the Node.js Streams API. [spawn](https://nodejs.org/api/child_process.html#child_processspawncommand-args-options) @@ -48,12 +47,14 @@ Available globally > [!IMPORTANT] > There are some differences with the [WHATWG standard](https://fetch.spec.whatwg.org). Mainly browser specific behavior is removed: -> * `keepalive` is always true -> * `request.body` can only be `string`, `Array`, `ArrayBuffer` or `Uint8Array` -> * `response.body` returns `null`. Use `response.text()`, `response.json()` etc -> * `mode`, `credentials`, `referrerPolicy`, `priority`, `cache` is not available/applicable +> +> - `keepalive` is always true +> - `request.body` can only be `string`, `Array`, `ArrayBuffer` or `Uint8Array` +> - `response.body` returns `null`. Use `response.text()`, `response.json()` etc +> - `mode`, `credentials`, `referrerPolicy`, `priority`, `cache` is not available/applicable ## fs + [accessSync](https://nodejs.org/api/fs.html#fsaccesssyncpath-mode) [mkdirSync](https://nodejs.org/api/fs.html#fsmkdirsyncpath-options) [readdirSync](https://nodejs.org/api/fs.html#fsreaddirsyncpath-options) @@ -83,16 +84,17 @@ Available globally ## hex ```typescript -export function encode(value:string|Array|ArrayBuffer|Uint8Array):string -export function decode(value:string):Uint8Array +export function encode( + value: string | Array | ArrayBuffer | Uint8Array +): string; +export function decode(value: string): Uint8Array; ``` ## module -[createRequire](https://nodejs.org/api/module.html#modulecreaterequirefilename) +[createRequire](https://nodejs.org/api/module.html#modulecreaterequirefilename) -> [!NOTE] -> `require` is available from esm modules natively. This function is just for compatibility +> [!NOTE] > `require` is available from esm modules natively. This function is just for compatibility ## os @@ -144,8 +146,8 @@ _Also available globally_ ## util -> [!IMPORTANT] -> Supported encodings: hex, base64, utf8, iso88591. +> [!IMPORTANT] +> Supported encodings: hex, base64, utf8, iso88591. > Supported methods: `encode` & `decode` [TextEncoder](https://nodejs.org/api/util.html#class-utiltextdecoder) @@ -155,24 +157,29 @@ _Also available globally_ ## uuid ```typescript +export const NIL: string; -export const NIL:string - -export function v1():string +export function v1(): string; -export function v3(name:string, namespace:Array|Uint8Array|String):string +export function v3( + name: string, + namespace: Array | Uint8Array | String +): string; -export function v4():string +export function v4(): string; -export function v5(name:string, namespace:Array|Uint8Array|String):string +export function v5( + name: string, + namespace: Array | Uint8Array | String +): string; -export function parse(value:string):Uint8Array +export function parse(value: string): Uint8Array; -export function stringify(arr:Array|Uint8Array):string +export function stringify(arr: Array | Uint8Array): string; -export function validate(arr:string):boolean +export function validate(arr: string): boolean; -export function version(arr:Array|Uint8Array):number +export function version(arr: Array | Uint8Array): number; ``` ## xml @@ -195,9 +202,9 @@ export class XMLParser(options?: XmlParserOptions){ ## net -> [!WARNING] +> [!WARNING] > These APIs uses native streams that is not 100% compatible with the Node.js Streams API. Server APIs like `createSever` provides limited functionality useful for testing purposes. Serverless applications typically don't expose servers. Some server options are not supported: -`highWaterMark`, `pauseOnConnect`, `keepAlive`, `noDelay`, `keepAliveInitialDelay` +> `highWaterMark`, `pauseOnConnect`, `keepAlive`, `noDelay`, `keepAliveInitialDelay` [createConnection](https://nodejs.org/api/net.html#netcreateconnection) diff --git a/CHANGELOG.md b/CHANGELOG.md index 779fbb1837..c0adf1d731 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ -* Optimized LLRT for containers. Use `llrt-container-arm` or `llrt-container-x64` -* Added a few FS sync APIs -* Embedded more `@smithy` packages -* Minor optimization tweaks -* Bugfixes & dependecy upgrades \ No newline at end of file +- Optimized LLRT for containers. Use `llrt-container-arm` or `llrt-container-x64` +- Added a few FS sync APIs +- Embedded more `@smithy` packages +- Minor optimization tweaks +- Bugfixes & dependecy upgrades diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index a0ea08c6ac..ec98f2b76e 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,4 +1,5 @@ ## Code of Conduct + This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact -opensource-codeofconduct@amazon.com with any additional questions or comments. \ No newline at end of file +opensource-codeofconduct@amazon.com with any additional questions or comments. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6bb314fa08..a25f517a2a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,16 +13,16 @@ We welcome you to use the GitHub issue tracker to report bugs or suggest feature When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: -* A reproducible test case or series of steps -* The version of our code being used -* Any modifications you've made relevant to the bug -* Anything unusual about your environment or deployment +- A reproducible test case or series of steps +- The version of our code being used +- Any modifications you've made relevant to the bug +- Anything unusual about your environment or deployment ## Contributing via Pull Requests Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: -1. You are working against the latest source on the *main* branch. +1. You are working against the latest source on the _main_ branch. 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 3. You open an issue to discuss any significant work - we would hate for your time to be wasted. diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 73d68f9e76..8fe304af5b 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -1,49 +1,49 @@ # Project Governance (Very Minimal Governance model) -This open source project is managed by a Steering Committee composed of the maintainers of this project. Maintainers are +This open source project is managed by a Steering Committee composed of the maintainers of this project. Maintainers are defined as individuals with full commit access to the project repositories. ## Steering Committee -The Steering Committee will be responsible for oversight of all technical, project, approval, and policy matters for the +The Steering Committee will be responsible for oversight of all technical, project, approval, and policy matters for the project. This notably includes brand and trademark management. -The Steering Committee members are listed in the MAINTAINERS.md file in the repository. New maintainers (and accordingly, -Steering Committee members) may be added or removed by no less than 3/4 affirmative vote of the Steering Committee. The +The Steering Committee members are listed in the MAINTAINERS.md file in the repository. New maintainers (and accordingly, +Steering Committee members) may be added or removed by no less than 3/4 affirmative vote of the Steering Committee. The Steering Committee will appoint a Chair responsible for organizing Steering Committee activity. If the Steering Committee -Chair is removed from the Committee (or the Chair steps down from that role), it is the responsibility of the Steering +Chair is removed from the Committee (or the Chair steps down from that role), it is the responsibility of the Steering Committe to appoint a new Chair. -The Steering Committee may, at its discretion, add or remove members who are not maintainers. +The Steering Committee may, at its discretion, add or remove members who are not maintainers. ## Voting -The Steering Committee will strive for all decisions to be made by consensus. While explicit agreement of the entire -Steering Committee is preferred, it is not required for consensus. Rather, the Steering Committee will determine -consensus based on their good faith consideration of a number of factors, including the dominant view of the Steering +The Steering Committee will strive for all decisions to be made by consensus. While explicit agreement of the entire +Steering Committee is preferred, it is not required for consensus. Rather, the Steering Committee will determine +consensus based on their good faith consideration of a number of factors, including the dominant view of the Steering Committee and nature of support and objections. The Steering Committee will document evidence of consensus in accordance with these requirements. If consensus cannot be reached, the Steering Committee will make the decision by a vote. The Steering Committee Chair will call a vote with reasonable notice to the Steering Committee, setting out a discussion period and a separate voting period. Any discussion may be conducted in person or electronically by text, voice, or video. -The discussion will be open to the public, with the notable exception of discussions involving embargoed security issues -or the addition or removal of maintainers, which will be private. In any vote, each voting representative will have one -vote. Except as specifically noted elsewhere in this document, decisions by vote require a simple majority vote of all +The discussion will be open to the public, with the notable exception of discussions involving embargoed security issues +or the addition or removal of maintainers, which will be private. In any vote, each voting representative will have one +vote. Except as specifically noted elsewhere in this document, decisions by vote require a simple majority vote of all voting members. ## Termination of Membership -A maintainer’s access (and accordingly, their position on the Steering Committee) will be removed if any of the following +A maintainer’s access (and accordingly, their position on the Steering Committee) will be removed if any of the following occur: -* Resignation: Written notice of resignation to the Steering Committee -* Steering Committee Vote: 3/4 affirmative vote of the Steering Committee to remove a member -* Unreachable Member: If a member is unresponsive for more than six months, the remaining active members of the Steering +- Resignation: Written notice of resignation to the Steering Committee +- Steering Committee Vote: 3/4 affirmative vote of the Steering Committee to remove a member +- Unreachable Member: If a member is unresponsive for more than six months, the remaining active members of the Steering Committee may vote to remove the member ## License of this document This document is a modified work of the GitHub Minimal Viable Governance model, located here:  -[https://github.com/github/MVG/](https://github.com/github/MVG/) +[https://github.com/github/MVG/](https://github.com/github/MVG/) This document may be used, modified, and/or distributed under the terms of the  [Creative Commons Attribution 4.0 International (CC-BY) license](https://creativecommons.org/licenses/by/4.0/legalcode). diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 37c7686bc0..5b470bb322 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -1,14 +1,15 @@ + ## Table of contents - [Overview](#overview) - [Current Maintainers](#current-maintainers) - [Labels](#labels) - [Maintainer Responsibilities](#maintainer-responsibilities) - - [Uphold Code of Conduct](#uphold-code-of-conduct) - - [Prioritize Security](#prioritize-security) - - [Review Pull Requests](#review-pull-requests) - - [Triage New Issues](#triage-new-issues) + - [Uphold Code of Conduct](#uphold-code-of-conduct) + - [Prioritize Security](#prioritize-security) + - [Review Pull Requests](#review-pull-requests) + - [Triage New Issues](#triage-new-issues) ## Overview @@ -18,10 +19,10 @@ This is document explains who the maintainers are (see below), what they do in t ## Current Maintainers -| Maintainer | GitHub ID | Affiliation | -| ----------------- | ------------------------------------------------------- | ----------- | -| Richard Davison | [richarddavison](https://github.com/richarddavison) | Amazon | -| Nik Pinski | [nikp](https://github.com/nikp) | Amazon | +| Maintainer | GitHub ID | Affiliation | +| --------------- | --------------------------------------------------- | ----------- | +| Richard Davison | [richarddavison](https://github.com/richarddavison) | Amazon | +| Nik Pinski | [nikp](https://github.com/nikp) | Amazon | ## Labels @@ -59,8 +60,8 @@ See [Common scenarios](#common-scenarios) section for additional guidance. Manage [labels](#labels), review issues regularly, and create new labels as needed by the project. Remove `triage` label when you're able to confirm the validity of a request, a bug can be reproduced, etc. Give priority to the original author for implementation, unless it is a sensitive task that is best handled by maintainers. -Make sure issues are assigned to our [board of activities](https://github.com/orgs/awslabs/projects/145/) +Make sure issues are assigned to our [board of activities](https://github.com/orgs/awslabs/projects/145/) Use our [labels](#labels) to signal good first issues to new community members, and to set expectation that this might need additional feedback from the author, other customers, experienced community members and/or maintainers. -> WORK IN PROGRESS \ No newline at end of file +> WORK IN PROGRESS diff --git a/Makefile b/Makefile index 1e8a63a2bf..3bd9f39f87 100644 --- a/Makefile +++ b/Makefile @@ -109,6 +109,7 @@ bundle/%.js: $(TS_SOURCES) node build.mjs fix: + npx pretty-quick cargo fix --allow-dirty cargo clippy --fix --allow-dirty cargo fmt @@ -146,14 +147,15 @@ run-cli: js test: export JS_MINIFY = 0 test: js - cargo run -- test -d bundle/__tests__/tests/unit + cargo run -- test -d bundle/__tests__/unit +test-e2e: export JS_MINIFY = 0 test-e2e: js - cargo run -- test -d bundle/__tests__/tests/e2e + cargo run -- test -d bundle/__tests__/e2e test-ci: export JS_MINIFY = 0 test-ci: clean-js | toolchain js cargo $(TOOLCHAIN) -Z panic-abort-tests test --target $(CURRENT_TARGET) -# cargo $(TOOLCHAIN) run -r --target $(CURRENT_TARGET) -- test -d bundle/__tests__/tests/e2e # temporary skip e2e tests when running on Github + cargo $(TOOLCHAIN) run -r --target $(CURRENT_TARGET) -- test -d bundle/__tests__/unit libs-arm64: lib/arm64/libzstd.a lib/zstd.h libs-x64: lib/x64/libzstd.a lib/zstd.h diff --git a/README.md b/README.md index b84af66270..475a55fee9 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,8 @@ Choose `Custom Runtime on Amazon Linux 2023`, upload `llrt-lambda-arm64.zip` or ### Option 3: Package LLRT in a container image -See our [AWS SAM example](./example/llrt-sam-container-image) or: +See our [AWS SAM example](./example/llrt-sam-container-image) or: + ```dockerfile FROM --platform=arm64 busybox WORKDIR /var/task/ @@ -58,10 +59,10 @@ instrumented with a layer containing the llrt runtime. You can use [`cdk-lambda-llrt` construct library](https://github.com/tmokmss/cdk-lambda-llrt) to deploy LLRT Lambda functions with AWS CDK. ```ts -import { LlrtFunction } from 'cdk-lambda-llrt'; +import { LlrtFunction } from "cdk-lambda-llrt"; -const handler = new LlrtFunction(this, 'Handler', { - entry: 'lambda/index.ts', +const handler = new LlrtFunction(this, "Handler", { + entry: "lambda/index.ts", }); ``` @@ -72,10 +73,12 @@ See [Construct Hub](https://constructs.dev/packages/cdk-lambda-llrt/) and [its e The best way to ensure your code is compatible with LLRT is to write tests and execute them using the built-in test runner. The test runner currently supports Jest/Chai assertions. There are two main types of tests you can create: Unit Tests + - Useful for validating specific modules and functions in isolation - Allow focused testing of individual components End-to-End (E2E) Tests + - Validate overall compatibility with AWS SDK and WinterCG compliance - Test the integration between all components - Confirm expected behavior from end-user perspective @@ -95,32 +98,31 @@ The test runner also has support for filters. Using filters is as simple as addi > [!NOTE] > LLRT only support a fraction of the Node.js APIs. It is **NOT** a drop in replacement for Node.js, nor will it ever be. Below is a high level overview of partially supported APIs and modules. For more details consult the [API](API.md) documentation -| | Node.js | LLRT ⚠️ | -| ------------- | ---------------------------------------- | ----- | -| buffer | ✔︎ | ✔︎️ | -| streams | ✔︎ | ✔︎\* | -| child_process | ✔︎ | ✔︎⏱ | -| net:sockets | ✔︎ | ✔︎⏱ | -| net:server | ✔︎ | ✔︎ | -| tls | ✔︎ | ✘⏱ | -| fetch | ✔︎ | ✔︎ | -| http | ✔︎ | ✘⏱\*\* | -| https | ✔︎ | ✘⏱\*\* | -| fs/promises | ✔︎ | ✔︎ | -| fs | ✔︎ | ✘⏱ | -| path | ✔︎ | ✔︎ | -| timers | ✔︎ | ✔︎ | -| uuid | ✔︎ | ✔︎ | -| crypto | ✔︎ | ✔︎ | -| process | ✔︎ | ✔︎ | -| encoding | ✔︎ | ✔︎ | -| console | ✔︎ | ✔︎ | -| events | ✔︎ | ✔︎ | -| ESM | ✔︎ | ✔︎ | -| CJS | ✔︎ | ✔︎ | -| async/await | ✔︎ | ✔︎ | -| Other modules | ✔︎ | ✘ | - +| | Node.js | LLRT ⚠️ | +| ------------- | ------- | ------- | +| buffer | ✔︎ | ✔︎️ | +| streams | ✔︎ | ✔︎\* | +| child_process | ✔︎ | ✔︎⏱ | +| net:sockets | ✔︎ | ✔︎⏱ | +| net:server | ✔︎ | ✔︎ | +| tls | ✔︎ | ✘⏱ | +| fetch | ✔︎ | ✔︎ | +| http | ✔︎ | ✘⏱\*\* | +| https | ✔︎ | ✘⏱\*\* | +| fs/promises | ✔︎ | ✔︎ | +| fs | ✔︎ | ✘⏱ | +| path | ✔︎ | ✔︎ | +| timers | ✔︎ | ✔︎ | +| uuid | ✔︎ | ✔︎ | +| crypto | ✔︎ | ✔︎ | +| process | ✔︎ | ✔︎ | +| encoding | ✔︎ | ✔︎ | +| console | ✔︎ | ✔︎ | +| events | ✔︎ | ✔︎ | +| ESM | ✔︎ | ✔︎ | +| CJS | ✔︎ | ✔︎ | +| async/await | ✔︎ | ✔︎ | +| Other modules | ✔︎ | ✘ | _⚠️ = partially supported in LLRT_ _⏱ = planned partial support_ @@ -140,46 +142,42 @@ LLRT can work with any bundler of your choice. Below are some configurations for ### Rollup ```javascript -import resolve from '@rollup/plugin-node-resolve'; -import commonjs from '@rollup/plugin-commonjs'; -import terser from '@rollup/plugin-terser'; +import resolve from "@rollup/plugin-node-resolve"; +import commonjs from "@rollup/plugin-commonjs"; +import terser from "@rollup/plugin-terser"; export default { - input: 'index.js', + input: "index.js", output: { - file: 'dist/bundle.js', - format: 'esm', + file: "dist/bundle.js", + format: "esm", sourcemap: true, - target: 'es2020', + target: "es2020", }, - plugins: [ - resolve(), - commonjs(), - terser(), - ], - external: ["@aws-sdk","@smithy","uuid"], + plugins: [resolve(), commonjs(), terser()], + external: ["@aws-sdk", "@smithy", "uuid"], }; ``` ### Webpack ```javascript -import TerserPlugin from 'terser-webpack-plugin'; -import nodeExternals from 'webpack-node-externals'; +import TerserPlugin from "terser-webpack-plugin"; +import nodeExternals from "webpack-node-externals"; export default { - entry: './index.js', + entry: "./index.js", output: { path: "dist", - filename: 'bundle.js', - libraryTarget: 'module', + filename: "bundle.js", + libraryTarget: "module", }, - target: 'web', - mode: 'production', + target: "web", + mode: "production", resolve: { - extensions: ['.js'], + extensions: [".js"], }, - externals: [nodeExternals(),"@aws-sdk","@smithy","uuid"], + externals: [nodeExternals(), "@aws-sdk", "@smithy", "uuid"], optimization: { minimize: true, minimizer: [ @@ -191,7 +189,6 @@ export default { ], }, }; - ``` ## Using AWS SDK (v3) with LLRT @@ -199,36 +196,37 @@ export default { LLRT includes many AWS SDK clients and utils as part of the runtime, built into the executable. These SDK Clients have been specifically fine-tuned to offer best performance while not compromising on compatibility. LLRT replaces some JavaScript dependencies used by the AWS SDK by native ones such as Hash calculations and XML parsing. V3 SDK packages not included in the list below have to be bundled with your source code while marking the following packages as external: -| Bundled AWS SDK packages | -| ------------------------------------- | -| @aws-sdk/client-dynamodb | -| @aws-sdk/lib-dynamodb | -| @aws-sdk/client-kms | -| @aws-sdk/client-lambda | -| @aws-sdk/client-s3 | -| @aws-sdk/client-secrets-manager | -| @aws-sdk/client-ses | -| @aws-sdk/client-sns | -| @aws-sdk/client-sqs | -| @aws-sdk/client-sts | -| @aws-sdk/client-ssm | -| @aws-sdk/client-cloudwatch-logs | -| @aws-sdk/client-cloudwatch-events | -| @aws-sdk/client-eventbridge | -| @aws-sdk/client-sfn | -| @aws-sdk/client-xray | -| @aws-sdk/client-cognito-identity | -| @aws-sdk/util-dynamodb | -| @aws-sdk/credential-providers | -| @smithy | +| Bundled AWS SDK packages | +| --------------------------------- | +| @aws-sdk/client-dynamodb | +| @aws-sdk/lib-dynamodb | +| @aws-sdk/client-kms | +| @aws-sdk/client-lambda | +| @aws-sdk/client-s3 | +| @aws-sdk/client-secrets-manager | +| @aws-sdk/client-ses | +| @aws-sdk/client-sns | +| @aws-sdk/client-sqs | +| @aws-sdk/client-sts | +| @aws-sdk/client-ssm | +| @aws-sdk/client-cloudwatch-logs | +| @aws-sdk/client-cloudwatch-events | +| @aws-sdk/client-eventbridge | +| @aws-sdk/client-sfn | +| @aws-sdk/client-xray | +| @aws-sdk/client-cognito-identity | +| @aws-sdk/util-dynamodb | +| @aws-sdk/credential-providers | +| @smithy | > [!IMPORTANT] > LLRT currently does not support returning streams from SDK responses. Use `response.Body.transformToString();` or `response.Body.transformToByteArray();` as shown below. +> > ```javascript ->const response = await client.send(command); ->// or 'transformToByteArray()' ->const str = await response.Body.transformToString(); ->``` +> const response = await client.send(command); +> // or 'transformToByteArray()' +> const str = await response.Body.transformToString(); +> ``` ## Running TypeScript with LLRT @@ -306,25 +304,29 @@ You should now have a `llrt-lambda-arm64.zip` or `llrt-lambda-x86.zip`. You can ## Running Lambda emulator Please note that in order to run the example you will need: + - Valid AWS credentials via a `~/.aws/credentials` or via environment variables. + ```bash export AWS_ACCESS_KEY_ID=XXX export AWS_SECRET_ACCESS_KEY=YYY export AWS_REGION=us-east-1 ``` + - A DynamoDB table (with `id` as the partition key) on `us-east-1` - The `dynamodb:PutItem` IAM permission on this table. You can use this policy (don't forget to modify ): + ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "putItem", - "Effect": "Allow", - "Action": "dynamodb:PutItem", - "Resource": "arn:aws:dynamodb:us-east-1::table/quickjs-table" - } - ] + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "putItem", + "Effect": "Allow", + "Action": "dynamodb:PutItem", + "Resource": "arn:aws:dynamodb:us-east-1::table/quickjs-table" + } + ] } ``` @@ -337,9 +339,11 @@ Then run llrt: make run ## Benchmark Methodology + Although Init Duration [reported by Lambda](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtime-environment.html) is commonly used to understand cold start impact on overall request latency, this metric does not include the time needed to copy code into the Lambda sandbox. The technical definition of Init Duration ([source](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-logging.html#node-logging-output)): + > For the first request served, the amount of time it took the runtime to load the function and run code outside of the handler method. Measuring round-trip request duration provides a more complete picture of user facing cold-start latency. diff --git a/benchmarks/v8-v7/base.js b/benchmarks/v8-v7/base.js index 62c37e1208..77a9a926a0 100644 --- a/benchmarks/v8-v7/base.js +++ b/benchmarks/v8-v7/base.js @@ -25,11 +25,9 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Simple framework for running the benchmark suites and // computing a score based on the timing measurements. - // A benchmark has a name (string) and a function that will be run to // do the performance measurement. The optional setup and tearDown // arguments are functions that will be invoked before and after @@ -38,11 +36,10 @@ function Benchmark(name, run, setup, tearDown) { this.name = name; this.run = run; - this.Setup = setup ? setup : function() { }; - this.TearDown = tearDown ? tearDown : function() { }; + this.Setup = setup ? setup : function () {}; + this.TearDown = tearDown ? tearDown : function () {}; } - // Benchmark results hold the benchmark and the measured time used to // run the benchmark. The benchmark score is computed later once a // full benchmark suite has run to completion. @@ -51,13 +48,11 @@ function BenchmarkResult(benchmark, time) { this.time = time; } - // Automatically convert results to numbers. Used by the geometric // mean computation. -BenchmarkResult.prototype.valueOf = function() { +BenchmarkResult.prototype.valueOf = function () { return this.time; -} - +}; // Suites of benchmarks consist of a name and the set of benchmarks in // addition to the reference timing that the final score will be based @@ -70,39 +65,35 @@ function BenchmarkSuite(name, reference, benchmarks) { BenchmarkSuite.suites.push(this); } - // Keep track of all declared benchmark suites. BenchmarkSuite.suites = []; - // Scores are not comparable across versions. Bump the version if // you're making changes that will affect that scores, e.g. if you add // a new benchmark or change an existing one. -BenchmarkSuite.version = '7'; - +BenchmarkSuite.version = "7"; // To make the benchmark results predictable, we replace Math.random // with a 100% deterministic alternative. -Math.random = (function() { +Math.random = (function () { var seed = 49734321; - return function() { + return function () { // Robert Jenkins' 32 bit integer hash function. - seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff; - seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff; - seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff; - seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff; - seed = ((seed + 0xfd7046c5) + (seed << 3)) & 0xffffffff; - seed = ((seed ^ 0xb55a4f09) ^ (seed >>> 16)) & 0xffffffff; + seed = (seed + 0x7ed55d16 + (seed << 12)) & 0xffffffff; + seed = (seed ^ 0xc761c23c ^ (seed >>> 19)) & 0xffffffff; + seed = (seed + 0x165667b1 + (seed << 5)) & 0xffffffff; + seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff; + seed = (seed + 0xfd7046c5 + (seed << 3)) & 0xffffffff; + seed = (seed ^ 0xb55a4f09 ^ (seed >>> 16)) & 0xffffffff; return (seed & 0xfffffff) / 0x10000000; }; })(); - // Runs all registered benchmark suites and optionally yields between // each individual benchmark to avoid running for too long in the // context of browsers. Once done, the final score is reported to the // runner. -BenchmarkSuite.RunSuites = function(runner) { +BenchmarkSuite.RunSuites = function (runner) { var continuation = null; var suites = BenchmarkSuite.suites; var length = suites.length; @@ -117,7 +108,7 @@ BenchmarkSuite.RunSuites = function(runner) { if (runner.NotifyStart) runner.NotifyStart(suite.name); continuation = suite.RunStep(runner); } - if (continuation && typeof window != 'undefined' && window.setTimeout) { + if (continuation && typeof window != "undefined" && window.setTimeout) { window.setTimeout(RunStep, 25); return; } @@ -129,52 +120,48 @@ BenchmarkSuite.RunSuites = function(runner) { } } RunStep(); -} - +}; // Counts the total number of registered benchmarks. Useful for // showing progress as a percentage. -BenchmarkSuite.CountBenchmarks = function() { +BenchmarkSuite.CountBenchmarks = function () { var result = 0; var suites = BenchmarkSuite.suites; for (var i = 0; i < suites.length; i++) { result += suites[i].benchmarks.length; } return result; -} - +}; // Computes the geometric mean of a set of numbers. -BenchmarkSuite.GeometricMean = function(numbers) { +BenchmarkSuite.GeometricMean = function (numbers) { var log = 0; for (var i = 0; i < numbers.length; i++) { log += Math.log(numbers[i]); } return Math.pow(Math.E, log / numbers.length); -} - +}; // Converts a score value to a string with at least three significant // digits. -BenchmarkSuite.FormatScore = function(value) { +BenchmarkSuite.FormatScore = function (value) { if (value > 100) { return value.toFixed(0); } else { return value.toPrecision(3); } -} +}; // Notifies the runner that we're done running a single benchmark in // the benchmark suite. This can be useful to report progress. -BenchmarkSuite.prototype.NotifyStep = function(result) { +BenchmarkSuite.prototype.NotifyStep = function (result) { this.results.push(result); if (this.runner.NotifyStep) this.runner.NotifyStep(result.benchmark.name); -} - +}; // Notifies the runner that we're done with running a suite and that // we have a result which can be reported to the user if needed. -BenchmarkSuite.prototype.NotifyResult = function() { +BenchmarkSuite.prototype.NotifyResult = function () { var mean = BenchmarkSuite.GeometricMean(this.results); var score = this.reference / mean; BenchmarkSuite.scores.push(score); @@ -182,23 +169,21 @@ BenchmarkSuite.prototype.NotifyResult = function() { var formatted = BenchmarkSuite.FormatScore(100 * score); this.runner.NotifyResult(this.name, formatted); } -} - +}; // Notifies the runner that running a benchmark resulted in an error. -BenchmarkSuite.prototype.NotifyError = function(error) { +BenchmarkSuite.prototype.NotifyError = function (error) { if (this.runner.NotifyError) { this.runner.NotifyError(this.name, error); } if (this.runner.NotifyStep) { this.runner.NotifyStep(this.name); } -} - +}; // Runs a single benchmark for at least a second and computes the // average time it takes to run a single iteration. -BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark, data) { +BenchmarkSuite.prototype.RunSingleBenchmark = function (benchmark, data) { function Measure(data) { var elapsed = 0; var start = new Date(); @@ -225,14 +210,13 @@ BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark, data) { this.NotifyStep(new BenchmarkResult(benchmark, usec)); return null; } -} - +}; // This function starts running a suite, but stops between each // individual benchmark in the suite and returns a continuation // function which can be invoked to run the next benchmark. Once the // last benchmark has been executed, null is returned. -BenchmarkSuite.prototype.RunStep = function(runner) { +BenchmarkSuite.prototype.RunStep = function (runner) { this.results = []; this.runner = runner; var length = this.benchmarks.length; @@ -266,7 +250,7 @@ BenchmarkSuite.prototype.RunStep = function(runner) { return null; } // If data is null, we're done with this benchmark. - return (data == null) ? RunNextTearDown : RunNextBenchmark(); + return data == null ? RunNextTearDown : RunNextBenchmark(); } function RunNextTearDown() { @@ -281,4 +265,4 @@ BenchmarkSuite.prototype.RunStep = function(runner) { // Start out running the setup. return RunNextSetup(); -} +}; diff --git a/benchmarks/v8-v7/crypto.js b/benchmarks/v8-v7/crypto.js index 531ad456e0..fc3e8dd174 100644 --- a/benchmarks/v8-v7/crypto.js +++ b/benchmarks/v8-v7/crypto.js @@ -29,14 +29,12 @@ * and disclaimer. */ - // The code has been adapted for use as a benchmark by Google. -var Crypto = new BenchmarkSuite('Crypto', 266181, [ +var Crypto = new BenchmarkSuite("Crypto", 266181, [ new Benchmark("Encrypt", encrypt), - new Benchmark("Decrypt", decrypt) + new Benchmark("Decrypt", decrypt), ]); - // Basic JavaScript BN library - subset useful for RSA encryption. // Bits per digit @@ -52,19 +50,21 @@ var BI_F2; // JavaScript engine analysis var canary = 0xdeadbeefcafe; -var j_lm = ((canary&0xffffff)==0xefcafe); +var j_lm = (canary & 0xffffff) == 0xefcafe; // (public) Constructor -function BigInteger(a,b,c) { +function BigInteger(a, b, c) { this.array = new Array(); - if(a != null) - if("number" == typeof a) this.fromNumber(a,b,c); - else if(b == null && "string" != typeof a) this.fromString(a,256); - else this.fromString(a,b); + if (a != null) + if ("number" == typeof a) this.fromNumber(a, b, c); + else if (b == null && "string" != typeof a) this.fromString(a, 256); + else this.fromString(a, b); } // return new, unset BigInteger -function nbi() { return new BigInteger(null); } +function nbi() { + return new BigInteger(null); +} // am: Compute w_j += (x*this_i), propagate carries, // c is initial carry, returns final carry. @@ -74,13 +74,13 @@ function nbi() { return new BigInteger(null); } // am1: use a single mult and divide to get the high bits, // max digit bits should be 26 because // max internal value = 2*dvalue^2-2*dvalue (< 2^53) -function am1(i,x,w,j,c,n) { +function am1(i, x, w, j, c, n) { var this_array = this.array; - var w_array = w.array; - while(--n >= 0) { - var v = x*this_array[i++]+w_array[j]+c; - c = Math.floor(v/0x4000000); - w_array[j++] = v&0x3ffffff; + var w_array = w.array; + while (--n >= 0) { + var v = x * this_array[i++] + w_array[j] + c; + c = Math.floor(v / 0x4000000); + w_array[j++] = v & 0x3ffffff; } return c; } @@ -88,53 +88,56 @@ function am1(i,x,w,j,c,n) { // am2 avoids a big mult-and-extract completely. // Max digit bits should be <= 30 because we do bitwise ops // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) -function am2(i,x,w,j,c,n) { +function am2(i, x, w, j, c, n) { var this_array = this.array; - var w_array = w.array; - var xl = x&0x7fff, xh = x>>15; - while(--n >= 0) { - var l = this_array[i]&0x7fff; - var h = this_array[i++]>>15; - var m = xh*l+h*xl; - l = xl*l+((m&0x7fff)<<15)+w_array[j]+(c&0x3fffffff); - c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); - w_array[j++] = l&0x3fffffff; + var w_array = w.array; + var xl = x & 0x7fff, + xh = x >> 15; + while (--n >= 0) { + var l = this_array[i] & 0x7fff; + var h = this_array[i++] >> 15; + var m = xh * l + h * xl; + l = xl * l + ((m & 0x7fff) << 15) + w_array[j] + (c & 0x3fffffff); + c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30); + w_array[j++] = l & 0x3fffffff; } return c; } // Alternately, set max digit bits to 28 since some // browsers slow down when dealing with 32-bit numbers. -function am3(i,x,w,j,c,n) { +function am3(i, x, w, j, c, n) { var this_array = this.array; - var w_array = w.array; - - var xl = x&0x3fff, xh = x>>14; - while(--n >= 0) { - var l = this_array[i]&0x3fff; - var h = this_array[i++]>>14; - var m = xh*l+h*xl; - l = xl*l+((m&0x3fff)<<14)+w_array[j]+c; - c = (l>>28)+(m>>14)+xh*h; - w_array[j++] = l&0xfffffff; + var w_array = w.array; + + var xl = x & 0x3fff, + xh = x >> 14; + while (--n >= 0) { + var l = this_array[i] & 0x3fff; + var h = this_array[i++] >> 14; + var m = xh * l + h * xl; + l = xl * l + ((m & 0x3fff) << 14) + w_array[j] + c; + c = (l >> 28) + (m >> 14) + xh * h; + w_array[j++] = l & 0xfffffff; } return c; } // This is tailored to VMs with 2-bit tagging. It makes sure // that all the computations stay within the 29 bits available. -function am4(i,x,w,j,c,n) { +function am4(i, x, w, j, c, n) { var this_array = this.array; - var w_array = w.array; - - var xl = x&0x1fff, xh = x>>13; - while(--n >= 0) { - var l = this_array[i]&0x1fff; - var h = this_array[i++]>>13; - var m = xh*l+h*xl; - l = xl*l+((m&0x1fff)<<13)+w_array[j]+c; - c = (l>>26)+(m>>13)+xh*h; - w_array[j++] = l&0x3ffffff; + var w_array = w.array; + + var xl = x & 0x1fff, + xh = x >> 13; + while (--n >= 0) { + var l = this_array[i] & 0x1fff; + var h = this_array[i++] >> 13; + var m = xh * l + h * xl; + l = xl * l + ((m & 0x1fff) << 13) + w_array[j] + c; + c = (l >> 26) + (m >> 13) + xh * h; + w_array[j++] = l & 0x3ffffff; } return c; } @@ -144,44 +147,45 @@ function am4(i,x,w,j,c,n) { // IE7 does 9% better with am3/28 than with am4/26. // Firefox (SM) gets 10% faster with am3/28 than with am4/26. -setupEngine = function(fn, bits) { +setupEngine = function (fn, bits) { BigInteger.prototype.am = fn; dbits = bits; BI_DB = dbits; - BI_DM = ((1<= 0; --i) r_array[i] = this_array[i]; + for (var i = this.t - 1; i >= 0; --i) r_array[i] = this_array[i]; r.t = this.t; r.s = this.s; } @@ -190,241 +194,289 @@ function bnpCopyTo(r) { function bnpFromInt(x) { var this_array = this.array; this.t = 1; - this.s = (x<0)?-1:0; - if(x > 0) this_array[0] = x; - else if(x < -1) this_array[0] = x+DV; + this.s = x < 0 ? -1 : 0; + if (x > 0) this_array[0] = x; + else if (x < -1) this_array[0] = x + DV; else this.t = 0; } // return bigint initialized to value -function nbv(i) { var r = nbi(); r.fromInt(i); return r; } +function nbv(i) { + var r = nbi(); + r.fromInt(i); + return r; +} // (protected) set from string and radix -function bnpFromString(s,b) { +function bnpFromString(s, b) { var this_array = this.array; var k; - if(b == 16) k = 4; - else if(b == 8) k = 3; - else if(b == 256) k = 8; // byte array - else if(b == 2) k = 1; - else if(b == 32) k = 5; - else if(b == 4) k = 2; - else { this.fromRadix(s,b); return; } + if (b == 16) k = 4; + else if (b == 8) k = 3; + else if (b == 256) + k = 8; // byte array + else if (b == 2) k = 1; + else if (b == 32) k = 5; + else if (b == 4) k = 2; + else { + this.fromRadix(s, b); + return; + } this.t = 0; this.s = 0; - var i = s.length, mi = false, sh = 0; - while(--i >= 0) { - var x = (k==8)?s[i]&0xff:intAt(s,i); - if(x < 0) { - if(s.charAt(i) == "-") mi = true; + var i = s.length, + mi = false, + sh = 0; + while (--i >= 0) { + var x = k == 8 ? s[i] & 0xff : intAt(s, i); + if (x < 0) { + if (s.charAt(i) == "-") mi = true; continue; } mi = false; - if(sh == 0) - this_array[this.t++] = x; - else if(sh+k > BI_DB) { - this_array[this.t-1] |= (x&((1<<(BI_DB-sh))-1))<>(BI_DB-sh)); - } - else - this_array[this.t-1] |= x< BI_DB) { + this_array[this.t - 1] |= (x & ((1 << (BI_DB - sh)) - 1)) << sh; + this_array[this.t++] = x >> (BI_DB - sh); + } else this_array[this.t - 1] |= x << sh; sh += k; - if(sh >= BI_DB) sh -= BI_DB; + if (sh >= BI_DB) sh -= BI_DB; } - if(k == 8 && (s[0]&0x80) != 0) { + if (k == 8 && (s[0] & 0x80) != 0) { this.s = -1; - if(sh > 0) this_array[this.t-1] |= ((1<<(BI_DB-sh))-1)< 0) this_array[this.t - 1] |= ((1 << (BI_DB - sh)) - 1) << sh; } this.clamp(); - if(mi) BigInteger.ZERO.subTo(this,this); + if (mi) BigInteger.ZERO.subTo(this, this); } // (protected) clamp off excess high words function bnpClamp() { var this_array = this.array; - var c = this.s&BI_DM; - while(this.t > 0 && this_array[this.t-1] == c) --this.t; + var c = this.s & BI_DM; + while (this.t > 0 && this_array[this.t - 1] == c) --this.t; } // (public) return string representation in given radix function bnToString(b) { var this_array = this.array; - if(this.s < 0) return "-"+this.negate().toString(b); + if (this.s < 0) return "-" + this.negate().toString(b); var k; - if(b == 16) k = 4; - else if(b == 8) k = 3; - else if(b == 2) k = 1; - else if(b == 32) k = 5; - else if(b == 4) k = 2; + if (b == 16) k = 4; + else if (b == 8) k = 3; + else if (b == 2) k = 1; + else if (b == 32) k = 5; + else if (b == 4) k = 2; else return this.toRadix(b); - var km = (1< 0) { - if(p < BI_DB && (d = this_array[i]>>p) > 0) { m = true; r = int2char(d); } - while(i >= 0) { - if(p < k) { - d = (this_array[i]&((1<>(p+=BI_DB-k); - } - else { - d = (this_array[i]>>(p-=k))&km; - if(p <= 0) { p += BI_DB; --i; } + var km = (1 << k) - 1, + d, + m = false, + r = "", + i = this.t; + var p = BI_DB - ((i * BI_DB) % k); + if (i-- > 0) { + if (p < BI_DB && (d = this_array[i] >> p) > 0) { + m = true; + r = int2char(d); + } + while (i >= 0) { + if (p < k) { + d = (this_array[i] & ((1 << p) - 1)) << (k - p); + d |= this_array[--i] >> (p += BI_DB - k); + } else { + d = (this_array[i] >> (p -= k)) & km; + if (p <= 0) { + p += BI_DB; + --i; + } } - if(d > 0) m = true; - if(m) r += int2char(d); + if (d > 0) m = true; + if (m) r += int2char(d); } } - return m?r:"0"; + return m ? r : "0"; } // (public) -this -function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } +function bnNegate() { + var r = nbi(); + BigInteger.ZERO.subTo(this, r); + return r; +} // (public) |this| -function bnAbs() { return (this.s<0)?this.negate():this; } +function bnAbs() { + return this.s < 0 ? this.negate() : this; +} // (public) return + if this > a, - if this < a, 0 if equal function bnCompareTo(a) { var this_array = this.array; var a_array = a.array; - var r = this.s-a.s; - if(r != 0) return r; + var r = this.s - a.s; + if (r != 0) return r; var i = this.t; - r = i-a.t; - if(r != 0) return r; - while(--i >= 0) if((r=this_array[i]-a_array[i]) != 0) return r; + r = i - a.t; + if (r != 0) return r; + while (--i >= 0) if ((r = this_array[i] - a_array[i]) != 0) return r; return 0; } // returns bit length of the integer x function nbits(x) { - var r = 1, t; - if((t=x>>>16) != 0) { x = t; r += 16; } - if((t=x>>8) != 0) { x = t; r += 8; } - if((t=x>>4) != 0) { x = t; r += 4; } - if((t=x>>2) != 0) { x = t; r += 2; } - if((t=x>>1) != 0) { x = t; r += 1; } + var r = 1, + t; + if ((t = x >>> 16) != 0) { + x = t; + r += 16; + } + if ((t = x >> 8) != 0) { + x = t; + r += 8; + } + if ((t = x >> 4) != 0) { + x = t; + r += 4; + } + if ((t = x >> 2) != 0) { + x = t; + r += 2; + } + if ((t = x >> 1) != 0) { + x = t; + r += 1; + } return r; } // (public) return the number of bits in "this" function bnBitLength() { var this_array = this.array; - if(this.t <= 0) return 0; - return BI_DB*(this.t-1)+nbits(this_array[this.t-1]^(this.s&BI_DM)); + if (this.t <= 0) return 0; + return ( + BI_DB * (this.t - 1) + nbits(this_array[this.t - 1] ^ (this.s & BI_DM)) + ); } // (protected) r = this << n*DB -function bnpDLShiftTo(n,r) { +function bnpDLShiftTo(n, r) { var this_array = this.array; var r_array = r.array; var i; - for(i = this.t-1; i >= 0; --i) r_array[i+n] = this_array[i]; - for(i = n-1; i >= 0; --i) r_array[i] = 0; - r.t = this.t+n; + for (i = this.t - 1; i >= 0; --i) r_array[i + n] = this_array[i]; + for (i = n - 1; i >= 0; --i) r_array[i] = 0; + r.t = this.t + n; r.s = this.s; } // (protected) r = this >> n*DB -function bnpDRShiftTo(n,r) { +function bnpDRShiftTo(n, r) { var this_array = this.array; var r_array = r.array; - for(var i = n; i < this.t; ++i) r_array[i-n] = this_array[i]; - r.t = Math.max(this.t-n,0); + for (var i = n; i < this.t; ++i) r_array[i - n] = this_array[i]; + r.t = Math.max(this.t - n, 0); r.s = this.s; } // (protected) r = this << n -function bnpLShiftTo(n,r) { +function bnpLShiftTo(n, r) { var this_array = this.array; var r_array = r.array; - var bs = n%BI_DB; - var cbs = BI_DB-bs; - var bm = (1<= 0; --i) { - r_array[i+ds+1] = (this_array[i]>>cbs)|c; - c = (this_array[i]&bm)<= 0; --i) { + r_array[i + ds + 1] = (this_array[i] >> cbs) | c; + c = (this_array[i] & bm) << bs; } - for(i = ds-1; i >= 0; --i) r_array[i] = 0; + for (i = ds - 1; i >= 0; --i) r_array[i] = 0; r_array[ds] = c; - r.t = this.t+ds+1; + r.t = this.t + ds + 1; r.s = this.s; r.clamp(); } // (protected) r = this >> n -function bnpRShiftTo(n,r) { +function bnpRShiftTo(n, r) { var this_array = this.array; var r_array = r.array; r.s = this.s; - var ds = Math.floor(n/BI_DB); - if(ds >= this.t) { r.t = 0; return; } - var bs = n%BI_DB; - var cbs = BI_DB-bs; - var bm = (1<>bs; - for(var i = ds+1; i < this.t; ++i) { - r_array[i-ds-1] |= (this_array[i]&bm)<>bs; + var ds = Math.floor(n / BI_DB); + if (ds >= this.t) { + r.t = 0; + return; } - if(bs > 0) r_array[this.t-ds-1] |= (this.s&bm)<> bs; + for (var i = ds + 1; i < this.t; ++i) { + r_array[i - ds - 1] |= (this_array[i] & bm) << cbs; + r_array[i - ds] = this_array[i] >> bs; + } + if (bs > 0) r_array[this.t - ds - 1] |= (this.s & bm) << cbs; + r.t = this.t - ds; r.clamp(); } // (protected) r = this - a -function bnpSubTo(a,r) { +function bnpSubTo(a, r) { var this_array = this.array; var r_array = r.array; var a_array = a.array; - var i = 0, c = 0, m = Math.min(a.t,this.t); - while(i < m) { - c += this_array[i]-a_array[i]; - r_array[i++] = c&BI_DM; + var i = 0, + c = 0, + m = Math.min(a.t, this.t); + while (i < m) { + c += this_array[i] - a_array[i]; + r_array[i++] = c & BI_DM; c >>= BI_DB; } - if(a.t < this.t) { + if (a.t < this.t) { c -= a.s; - while(i < this.t) { + while (i < this.t) { c += this_array[i]; - r_array[i++] = c&BI_DM; + r_array[i++] = c & BI_DM; c >>= BI_DB; } c += this.s; - } - else { + } else { c += this.s; - while(i < a.t) { + while (i < a.t) { c -= a_array[i]; - r_array[i++] = c&BI_DM; + r_array[i++] = c & BI_DM; c >>= BI_DB; } c -= a.s; } - r.s = (c<0)?-1:0; - if(c < -1) r_array[i++] = BI_DV+c; - else if(c > 0) r_array[i++] = c; + r.s = c < 0 ? -1 : 0; + if (c < -1) r_array[i++] = BI_DV + c; + else if (c > 0) r_array[i++] = c; r.t = i; r.clamp(); } // (protected) r = this * a, r != this,a (HAC 14.12) // "this" should be the larger one if appropriate. -function bnpMultiplyTo(a,r) { +function bnpMultiplyTo(a, r) { var this_array = this.array; var r_array = r.array; - var x = this.abs(), y = a.abs(); + var x = this.abs(), + y = a.abs(); var y_array = y.array; var i = x.t; - r.t = i+y.t; - while(--i >= 0) r_array[i] = 0; - for(i = 0; i < y.t; ++i) r_array[i+x.t] = x.am(0,y_array[i],r,i,0,x.t); + r.t = i + y.t; + while (--i >= 0) r_array[i] = 0; + for (i = 0; i < y.t; ++i) + r_array[i + x.t] = x.am(0, y_array[i], r, i, 0, x.t); r.s = 0; r.clamp(); - if(this.s != a.s) BigInteger.ZERO.subTo(r,r); + if (this.s != a.s) BigInteger.ZERO.subTo(r, r); } // (protected) r = this^2, r != this (HAC 14.16) @@ -433,92 +485,128 @@ function bnpSquareTo(r) { var x_array = x.array; var r_array = r.array; - var i = r.t = 2*x.t; - while(--i >= 0) r_array[i] = 0; - for(i = 0; i < x.t-1; ++i) { - var c = x.am(i,x_array[i],r,2*i,0,1); - if((r_array[i+x.t]+=x.am(i+1,2*x_array[i],r,2*i+1,c,x.t-i-1)) >= BI_DV) { - r_array[i+x.t] -= BI_DV; - r_array[i+x.t+1] = 1; + var i = (r.t = 2 * x.t); + while (--i >= 0) r_array[i] = 0; + for (i = 0; i < x.t - 1; ++i) { + var c = x.am(i, x_array[i], r, 2 * i, 0, 1); + if ( + (r_array[i + x.t] += x.am( + i + 1, + 2 * x_array[i], + r, + 2 * i + 1, + c, + x.t - i - 1 + )) >= BI_DV + ) { + r_array[i + x.t] -= BI_DV; + r_array[i + x.t + 1] = 1; } } - if(r.t > 0) r_array[r.t-1] += x.am(i,x_array[i],r,2*i,0,1); + if (r.t > 0) r_array[r.t - 1] += x.am(i, x_array[i], r, 2 * i, 0, 1); r.s = 0; r.clamp(); } // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) // r != q, this != m. q or r may be null. -function bnpDivRemTo(m,q,r) { +function bnpDivRemTo(m, q, r) { var pm = m.abs(); - if(pm.t <= 0) return; + if (pm.t <= 0) return; var pt = this.abs(); - if(pt.t < pm.t) { - if(q != null) q.fromInt(0); - if(r != null) this.copyTo(r); + if (pt.t < pm.t) { + if (q != null) q.fromInt(0); + if (r != null) this.copyTo(r); return; } - if(r == null) r = nbi(); - var y = nbi(), ts = this.s, ms = m.s; + if (r == null) r = nbi(); + var y = nbi(), + ts = this.s, + ms = m.s; var pm_array = pm.array; - var nsh = BI_DB-nbits(pm_array[pm.t-1]); // normalize modulus - if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } - else { pm.copyTo(y); pt.copyTo(r); } + var nsh = BI_DB - nbits(pm_array[pm.t - 1]); // normalize modulus + if (nsh > 0) { + pm.lShiftTo(nsh, y); + pt.lShiftTo(nsh, r); + } else { + pm.copyTo(y); + pt.copyTo(r); + } var ys = y.t; var y_array = y.array; - var y0 = y_array[ys-1]; - if(y0 == 0) return; - var yt = y0*(1<1)?y_array[ys-2]>>BI_F2:0); - var d1 = BI_FV/yt, d2 = (1< 1 ? y_array[ys - 2] >> BI_F2 : 0); + var d1 = BI_FV / yt, + d2 = (1 << BI_F1) / yt, + e = 1 << BI_F2; + var i = r.t, + j = i - ys, + t = q == null ? nbi() : q; + y.dlShiftTo(j, t); var r_array = r.array; - if(r.compareTo(t) >= 0) { + if (r.compareTo(t) >= 0) { r_array[r.t++] = 1; - r.subTo(t,r); + r.subTo(t, r); } - BigInteger.ONE.dlShiftTo(ys,t); - t.subTo(y,y); // "negative" y so we can replace sub with am later - while(y.t < ys) y_array[y.t++] = 0; - while(--j >= 0) { + BigInteger.ONE.dlShiftTo(ys, t); + t.subTo(y, y); // "negative" y so we can replace sub with am later + while (y.t < ys) y_array[y.t++] = 0; + while (--j >= 0) { // Estimate quotient digit - var qd = (r_array[--i]==y0)?BI_DM:Math.floor(r_array[i]*d1+(r_array[i-1]+e)*d2); - if((r_array[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out - y.dlShiftTo(j,t); - r.subTo(t,r); - while(r_array[i] < --qd) r.subTo(t,r); + var qd = + r_array[--i] == y0 + ? BI_DM + : Math.floor(r_array[i] * d1 + (r_array[i - 1] + e) * d2); + if ((r_array[i] += y.am(0, qd, r, j, 0, ys)) < qd) { + // Try it out + y.dlShiftTo(j, t); + r.subTo(t, r); + while (r_array[i] < --qd) r.subTo(t, r); } } - if(q != null) { - r.drShiftTo(ys,q); - if(ts != ms) BigInteger.ZERO.subTo(q,q); + if (q != null) { + r.drShiftTo(ys, q); + if (ts != ms) BigInteger.ZERO.subTo(q, q); } r.t = ys; r.clamp(); - if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder - if(ts < 0) BigInteger.ZERO.subTo(r,r); + if (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder + if (ts < 0) BigInteger.ZERO.subTo(r, r); } // (public) this mod a function bnMod(a) { var r = nbi(); - this.abs().divRemTo(a,null,r); - if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); + this.abs().divRemTo(a, null, r); + if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r); return r; } // Modular reduction using "classic" algorithm -function Classic(m) { this.m = m; } +function Classic(m) { + this.m = m; +} function cConvert(x) { - if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); + if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); else return x; } -function cRevert(x) { return x; } -function cReduce(x) { x.divRemTo(this.m,null,x); } -function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } -function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } +function cRevert(x) { + return x; +} +function cReduce(x) { + x.divRemTo(this.m, null, x); +} +function cMulTo(x, y, r) { + x.multiplyTo(y, r); + this.reduce(r); +} +function cSqrTo(x, r) { + x.squareTo(r); + this.reduce(r); +} Classic.prototype.convert = cConvert; Classic.prototype.revert = cRevert; @@ -538,36 +626,36 @@ Classic.prototype.sqrTo = cSqrTo; // JS multiply "overflows" differently from C/C++, so care is needed here. function bnpInvDigit() { var this_array = this.array; - if(this.t < 1) return 0; + if (this.t < 1) return 0; var x = this_array[0]; - if((x&1) == 0) return 0; - var y = x&3; // y == 1/x mod 2^2 - y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 - y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 - y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 + if ((x & 1) == 0) return 0; + var y = x & 3; // y == 1/x mod 2^2 + y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4 + y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8 + y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16 // last step - calculate inverse mod DV directly; // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints - y = (y*(2-x*y%BI_DV))%BI_DV; // y == 1/x mod 2^dbits + y = (y * (2 - ((x * y) % BI_DV))) % BI_DV; // y == 1/x mod 2^dbits // we really want the negative inverse, and -DV < y < DV - return (y>0)?BI_DV-y:-y; + return y > 0 ? BI_DV - y : -y; } // Montgomery reduction function Montgomery(m) { this.m = m; this.mp = m.invDigit(); - this.mpl = this.mp&0x7fff; - this.mph = this.mp>>15; - this.um = (1<<(BI_DB-15))-1; - this.mt2 = 2*m.t; + this.mpl = this.mp & 0x7fff; + this.mph = this.mp >> 15; + this.um = (1 << (BI_DB - 15)) - 1; + this.mt2 = 2 * m.t; } // xR mod m function montConvert(x) { var r = nbi(); - x.abs().dlShiftTo(this.m.t,r); - r.divRemTo(this.m,null,r); - if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); + x.abs().dlShiftTo(this.m.t, r); + r.divRemTo(this.m, null, r); + if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r); return r; } @@ -582,28 +670,41 @@ function montRevert(x) { // x = x/R mod m (HAC 14.32) function montReduce(x) { var x_array = x.array; - while(x.t <= this.mt2) // pad x so am has enough room later + while (x.t <= this.mt2) + // pad x so am has enough room later x_array[x.t++] = 0; - for(var i = 0; i < this.m.t; ++i) { + for (var i = 0; i < this.m.t; ++i) { // faster way of calculating u0 = x[i]*mp mod DV - var j = x_array[i]&0x7fff; - var u0 = (j*this.mpl+(((j*this.mph+(x_array[i]>>15)*this.mpl)&this.um)<<15))&BI_DM; + var j = x_array[i] & 0x7fff; + var u0 = + (j * this.mpl + + (((j * this.mph + (x_array[i] >> 15) * this.mpl) & this.um) << 15)) & + BI_DM; // use am to combine the multiply-shift-add into one call - j = i+this.m.t; - x_array[j] += this.m.am(0,u0,x,i,0,this.m.t); + j = i + this.m.t; + x_array[j] += this.m.am(0, u0, x, i, 0, this.m.t); // propagate carry - while(x_array[j] >= BI_DV) { x_array[j] -= BI_DV; x_array[++j]++; } + while (x_array[j] >= BI_DV) { + x_array[j] -= BI_DV; + x_array[++j]++; + } } x.clamp(); - x.drShiftTo(this.m.t,x); - if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); + x.drShiftTo(this.m.t, x); + if (x.compareTo(this.m) >= 0) x.subTo(this.m, x); } // r = "x^2/R mod m"; x != r -function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } +function montSqrTo(x, r) { + x.squareTo(r); + this.reduce(r); +} // r = "xy/R mod m"; x,y != r -function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } +function montMulTo(x, y, r) { + x.multiplyTo(y, r); + this.reduce(r); +} Montgomery.prototype.convert = montConvert; Montgomery.prototype.revert = montRevert; @@ -614,27 +715,35 @@ Montgomery.prototype.sqrTo = montSqrTo; // (protected) true iff this is even function bnpIsEven() { var this_array = this.array; - return ((this.t>0)?(this_array[0]&1):this.s) == 0; + return (this.t > 0 ? this_array[0] & 1 : this.s) == 0; } // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) -function bnpExp(e,z) { - if(e > 0xffffffff || e < 1) return BigInteger.ONE; - var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; +function bnpExp(e, z) { + if (e > 0xffffffff || e < 1) return BigInteger.ONE; + var r = nbi(), + r2 = nbi(), + g = z.convert(this), + i = nbits(e) - 1; g.copyTo(r); - while(--i >= 0) { - z.sqrTo(r,r2); - if((e&(1< 0) z.mulTo(r2,g,r); - else { var t = r; r = r2; r2 = t; } + while (--i >= 0) { + z.sqrTo(r, r2); + if ((e & (1 << i)) > 0) z.mulTo(r2, g, r); + else { + var t = r; + r = r2; + r2 = t; + } } return z.revert(r); } // (public) this^e % m, 0 <= e < 2^32 -function bnModPowInt(e,m) { +function bnModPowInt(e, m) { var z; - if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); - return this.exp(e,z); + if (e < 256 || m.isEven()) z = new Classic(m); + else z = new Montgomery(m); + return this.exp(e, z); } // protected @@ -673,178 +782,228 @@ BigInteger.ONE = nbv(1); // Extended JavaScript BN functions, required for RSA private ops. // (public) -function bnClone() { var r = nbi(); this.copyTo(r); return r; } +function bnClone() { + var r = nbi(); + this.copyTo(r); + return r; +} // (public) return value as integer function bnIntValue() { var this_array = this.array; - if(this.s < 0) { - if(this.t == 1) return this_array[0]-BI_DV; - else if(this.t == 0) return -1; - } - else if(this.t == 1) return this_array[0]; - else if(this.t == 0) return 0; + if (this.s < 0) { + if (this.t == 1) return this_array[0] - BI_DV; + else if (this.t == 0) return -1; + } else if (this.t == 1) return this_array[0]; + else if (this.t == 0) return 0; // assumes 16 < DB < 32 - return ((this_array[1]&((1<<(32-BI_DB))-1))<>24; + return this.t == 0 ? this.s : (this_array[0] << 24) >> 24; } // (public) return value as short (assumes DB>=16) function bnShortValue() { var this_array = this.array; - return (this.t==0)?this.s:(this_array[0]<<16)>>16; + return this.t == 0 ? this.s : (this_array[0] << 16) >> 16; } // (protected) return x s.t. r^x < DV -function bnpChunkSize(r) { return Math.floor(Math.LN2*BI_DB/Math.log(r)); } +function bnpChunkSize(r) { + return Math.floor((Math.LN2 * BI_DB) / Math.log(r)); +} // (public) 0 if this == 0, 1 if this > 0 function bnSigNum() { var this_array = this.array; - if(this.s < 0) return -1; - else if(this.t <= 0 || (this.t == 1 && this_array[0] <= 0)) return 0; + if (this.s < 0) return -1; + else if (this.t <= 0 || (this.t == 1 && this_array[0] <= 0)) return 0; else return 1; } // (protected) convert to radix string function bnpToRadix(b) { - if(b == null) b = 10; - if(this.signum() == 0 || b < 2 || b > 36) return "0"; + if (b == null) b = 10; + if (this.signum() == 0 || b < 2 || b > 36) return "0"; var cs = this.chunkSize(b); - var a = Math.pow(b,cs); - var d = nbv(a), y = nbi(), z = nbi(), r = ""; - this.divRemTo(d,y,z); - while(y.signum() > 0) { - r = (a+z.intValue()).toString(b).substr(1) + r; - y.divRemTo(d,y,z); + var a = Math.pow(b, cs); + var d = nbv(a), + y = nbi(), + z = nbi(), + r = ""; + this.divRemTo(d, y, z); + while (y.signum() > 0) { + r = (a + z.intValue()).toString(b).substr(1) + r; + y.divRemTo(d, y, z); } return z.intValue().toString(b) + r; } // (protected) convert from radix string -function bnpFromRadix(s,b) { +function bnpFromRadix(s, b) { this.fromInt(0); - if(b == null) b = 10; + if (b == null) b = 10; var cs = this.chunkSize(b); - var d = Math.pow(b,cs), mi = false, j = 0, w = 0; - for(var i = 0; i < s.length; ++i) { - var x = intAt(s,i); - if(x < 0) { - if(s.charAt(i) == "-" && this.signum() == 0) mi = true; + var d = Math.pow(b, cs), + mi = false, + j = 0, + w = 0; + for (var i = 0; i < s.length; ++i) { + var x = intAt(s, i); + if (x < 0) { + if (s.charAt(i) == "-" && this.signum() == 0) mi = true; continue; } - w = b*w+x; - if(++j >= cs) { + w = b * w + x; + if (++j >= cs) { this.dMultiply(d); - this.dAddOffset(w,0); + this.dAddOffset(w, 0); j = 0; w = 0; } } - if(j > 0) { - this.dMultiply(Math.pow(b,j)); - this.dAddOffset(w,0); + if (j > 0) { + this.dMultiply(Math.pow(b, j)); + this.dAddOffset(w, 0); } - if(mi) BigInteger.ZERO.subTo(this,this); + if (mi) BigInteger.ZERO.subTo(this, this); } // (protected) alternate constructor -function bnpFromNumber(a,b,c) { - if("number" == typeof b) { +function bnpFromNumber(a, b, c) { + if ("number" == typeof b) { // new BigInteger(int,int,RNG) - if(a < 2) this.fromInt(1); + if (a < 2) this.fromInt(1); else { - this.fromNumber(a,c); - if(!this.testBit(a-1)) // force MSB set - this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); - if(this.isEven()) this.dAddOffset(1,0); // force odd - while(!this.isProbablePrime(b)) { - this.dAddOffset(2,0); - if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); + this.fromNumber(a, c); + if (!this.testBit(a - 1)) + // force MSB set + this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this); + if (this.isEven()) this.dAddOffset(1, 0); // force odd + while (!this.isProbablePrime(b)) { + this.dAddOffset(2, 0); + if (this.bitLength() > a) + this.subTo(BigInteger.ONE.shiftLeft(a - 1), this); } } - } - else { + } else { // new BigInteger(int,RNG) - var x = new Array(), t = a&7; - x.length = (a>>3)+1; + var x = new Array(), + t = a & 7; + x.length = (a >> 3) + 1; b.nextBytes(x); - if(t > 0) x[0] &= ((1< 0) x[0] &= (1 << t) - 1; + else x[0] = 0; + this.fromString(x, 256); } } // (public) convert to bigendian byte array function bnToByteArray() { var this_array = this.array; - var i = this.t, r = new Array(); + var i = this.t, + r = new Array(); r[0] = this.s; - var p = BI_DB-(i*BI_DB)%8, d, k = 0; - if(i-- > 0) { - if(p < BI_DB && (d = this_array[i]>>p) != (this.s&BI_DM)>>p) - r[k++] = d|(this.s<<(BI_DB-p)); - while(i >= 0) { - if(p < 8) { - d = (this_array[i]&((1<>(p+=BI_DB-8); - } - else { - d = (this_array[i]>>(p-=8))&0xff; - if(p <= 0) { p += BI_DB; --i; } + var p = BI_DB - ((i * BI_DB) % 8), + d, + k = 0; + if (i-- > 0) { + if (p < BI_DB && (d = this_array[i] >> p) != (this.s & BI_DM) >> p) + r[k++] = d | (this.s << (BI_DB - p)); + while (i >= 0) { + if (p < 8) { + d = (this_array[i] & ((1 << p) - 1)) << (8 - p); + d |= this_array[--i] >> (p += BI_DB - 8); + } else { + d = (this_array[i] >> (p -= 8)) & 0xff; + if (p <= 0) { + p += BI_DB; + --i; + } } - if((d&0x80) != 0) d |= -256; - if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; - if(k > 0 || d != this.s) r[k++] = d; + if ((d & 0x80) != 0) d |= -256; + if (k == 0 && (this.s & 0x80) != (d & 0x80)) ++k; + if (k > 0 || d != this.s) r[k++] = d; } } return r; } -function bnEquals(a) { return(this.compareTo(a)==0); } -function bnMin(a) { return(this.compareTo(a)<0)?this:a; } -function bnMax(a) { return(this.compareTo(a)>0)?this:a; } +function bnEquals(a) { + return this.compareTo(a) == 0; +} +function bnMin(a) { + return this.compareTo(a) < 0 ? this : a; +} +function bnMax(a) { + return this.compareTo(a) > 0 ? this : a; +} // (protected) r = this op a (bitwise) -function bnpBitwiseTo(a,op,r) { +function bnpBitwiseTo(a, op, r) { var this_array = this.array; - var a_array = a.array; - var r_array = r.array; - var i, f, m = Math.min(a.t,this.t); - for(i = 0; i < m; ++i) r_array[i] = op(this_array[i],a_array[i]); - if(a.t < this.t) { - f = a.s&BI_DM; - for(i = m; i < this.t; ++i) r_array[i] = op(this_array[i],f); + var a_array = a.array; + var r_array = r.array; + var i, + f, + m = Math.min(a.t, this.t); + for (i = 0; i < m; ++i) r_array[i] = op(this_array[i], a_array[i]); + if (a.t < this.t) { + f = a.s & BI_DM; + for (i = m; i < this.t; ++i) r_array[i] = op(this_array[i], f); r.t = this.t; - } - else { - f = this.s&BI_DM; - for(i = m; i < a.t; ++i) r_array[i] = op(f,a_array[i]); + } else { + f = this.s & BI_DM; + for (i = m; i < a.t; ++i) r_array[i] = op(f, a_array[i]); r.t = a.t; } - r.s = op(this.s,a.s); + r.s = op(this.s, a.s); r.clamp(); } // (public) this & a -function op_and(x,y) { return x&y; } -function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } +function op_and(x, y) { + return x & y; +} +function bnAnd(a) { + var r = nbi(); + this.bitwiseTo(a, op_and, r); + return r; +} // (public) this | a -function op_or(x,y) { return x|y; } -function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } +function op_or(x, y) { + return x | y; +} +function bnOr(a) { + var r = nbi(); + this.bitwiseTo(a, op_or, r); + return r; +} // (public) this ^ a -function op_xor(x,y) { return x^y; } -function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } +function op_xor(x, y) { + return x ^ y; +} +function bnXor(a) { + var r = nbi(); + this.bitwiseTo(a, op_xor, r); + return r; +} // (public) this & ~a -function op_andnot(x,y) { return x&~y; } -function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } +function op_andnot(x, y) { + return x & ~y; +} +function bnAndNot(a) { + var r = nbi(); + this.bitwiseTo(a, op_andnot, r); + return r; +} // (public) ~this function bnNot() { @@ -852,7 +1011,7 @@ function bnNot() { var r = nbi(); var r_array = r.array; - for(var i = 0; i < this.t; ++i) r_array[i] = BI_DM&~this_array[i]; + for (var i = 0; i < this.t; ++i) r_array[i] = BI_DM & ~this_array[i]; r.t = this.t; r.s = ~this.s; return r; @@ -861,159 +1020,211 @@ function bnNot() { // (public) this << n function bnShiftLeft(n) { var r = nbi(); - if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); + if (n < 0) this.rShiftTo(-n, r); + else this.lShiftTo(n, r); return r; } // (public) this >> n function bnShiftRight(n) { var r = nbi(); - if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); + if (n < 0) this.lShiftTo(-n, r); + else this.rShiftTo(n, r); return r; } // return index of lowest 1-bit in x, x < 2^31 function lbit(x) { - if(x == 0) return -1; + if (x == 0) return -1; var r = 0; - if((x&0xffff) == 0) { x >>= 16; r += 16; } - if((x&0xff) == 0) { x >>= 8; r += 8; } - if((x&0xf) == 0) { x >>= 4; r += 4; } - if((x&3) == 0) { x >>= 2; r += 2; } - if((x&1) == 0) ++r; + if ((x & 0xffff) == 0) { + x >>= 16; + r += 16; + } + if ((x & 0xff) == 0) { + x >>= 8; + r += 8; + } + if ((x & 0xf) == 0) { + x >>= 4; + r += 4; + } + if ((x & 3) == 0) { + x >>= 2; + r += 2; + } + if ((x & 1) == 0) ++r; return r; } // (public) returns index of lowest 1-bit (or -1 if none) function bnGetLowestSetBit() { var this_array = this.array; - for(var i = 0; i < this.t; ++i) - if(this_array[i] != 0) return i*BI_DB+lbit(this_array[i]); - if(this.s < 0) return this.t*BI_DB; + for (var i = 0; i < this.t; ++i) + if (this_array[i] != 0) return i * BI_DB + lbit(this_array[i]); + if (this.s < 0) return this.t * BI_DB; return -1; } // return number of 1 bits in x function cbit(x) { var r = 0; - while(x != 0) { x &= x-1; ++r; } + while (x != 0) { + x &= x - 1; + ++r; + } return r; } // (public) return number of set bits function bnBitCount() { - var r = 0, x = this.s&BI_DM; - for(var i = 0; i < this.t; ++i) r += cbit(this_array[i]^x); + var r = 0, + x = this.s & BI_DM; + for (var i = 0; i < this.t; ++i) r += cbit(this_array[i] ^ x); return r; } // (public) true iff nth bit is set function bnTestBit(n) { var this_array = this.array; - var j = Math.floor(n/BI_DB); - if(j >= this.t) return(this.s!=0); - return((this_array[j]&(1<<(n%BI_DB)))!=0); + var j = Math.floor(n / BI_DB); + if (j >= this.t) return this.s != 0; + return (this_array[j] & (1 << n % BI_DB)) != 0; } // (protected) this op (1<>= BI_DB; } - if(a.t < this.t) { + if (a.t < this.t) { c += a.s; - while(i < this.t) { + while (i < this.t) { c += this_array[i]; - r_array[i++] = c&BI_DM; + r_array[i++] = c & BI_DM; c >>= BI_DB; } c += this.s; - } - else { + } else { c += this.s; - while(i < a.t) { + while (i < a.t) { c += a_array[i]; - r_array[i++] = c&BI_DM; + r_array[i++] = c & BI_DM; c >>= BI_DB; } c += a.s; } - r.s = (c<0)?-1:0; - if(c > 0) r_array[i++] = c; - else if(c < -1) r_array[i++] = BI_DV+c; + r.s = c < 0 ? -1 : 0; + if (c > 0) r_array[i++] = c; + else if (c < -1) r_array[i++] = BI_DV + c; r.t = i; r.clamp(); } // (public) this + a -function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } +function bnAdd(a) { + var r = nbi(); + this.addTo(a, r); + return r; +} // (public) this - a -function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } +function bnSubtract(a) { + var r = nbi(); + this.subTo(a, r); + return r; +} // (public) this * a -function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } +function bnMultiply(a) { + var r = nbi(); + this.multiplyTo(a, r); + return r; +} // (public) this / a -function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } +function bnDivide(a) { + var r = nbi(); + this.divRemTo(a, r, null); + return r; +} // (public) this % a -function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } +function bnRemainder(a) { + var r = nbi(); + this.divRemTo(a, null, r); + return r; +} // (public) [this/a,this%a] function bnDivideAndRemainder(a) { - var q = nbi(), r = nbi(); - this.divRemTo(a,q,r); - return new Array(q,r); + var q = nbi(), + r = nbi(); + this.divRemTo(a, q, r); + return new Array(q, r); } // (protected) this *= n, this >= 0, 1 < n < DV function bnpDMultiply(n) { var this_array = this.array; - this_array[this.t] = this.am(0,n-1,this,0,0,this.t); + this_array[this.t] = this.am(0, n - 1, this, 0, 0, this.t); ++this.t; this.clamp(); } // (protected) this += n << w words, this >= 0 -function bnpDAddOffset(n,w) { +function bnpDAddOffset(n, w) { var this_array = this.array; - while(this.t <= w) this_array[this.t++] = 0; + while (this.t <= w) this_array[this.t++] = 0; this_array[w] += n; - while(this_array[w] >= BI_DV) { + while (this_array[w] >= BI_DV) { this_array[w] -= BI_DV; - if(++w >= this.t) this_array[this.t++] = 0; + if (++w >= this.t) this_array[this.t++] = 0; ++this_array[w]; } } // A "null" reducer function NullExp() {} -function nNop(x) { return x; } -function nMulTo(x,y,r) { x.multiplyTo(y,r); } -function nSqrTo(x,r) { x.squareTo(r); } +function nNop(x) { + return x; +} +function nMulTo(x, y, r) { + x.multiplyTo(y, r); +} +function nSqrTo(x, r) { + x.squareTo(r); +} NullExp.prototype.convert = nNop; NullExp.prototype.revert = nNop; @@ -1021,36 +1232,46 @@ NullExp.prototype.mulTo = nMulTo; NullExp.prototype.sqrTo = nSqrTo; // (public) this^e -function bnPow(e) { return this.exp(e,new NullExp()); } +function bnPow(e) { + return this.exp(e, new NullExp()); +} // (protected) r = lower n words of "this * a", a.t <= n // "this" should be the larger one if appropriate. -function bnpMultiplyLowerTo(a,n,r) { +function bnpMultiplyLowerTo(a, n, r) { var r_array = r.array; var a_array = a.array; - var i = Math.min(this.t+a.t,n); + var i = Math.min(this.t + a.t, n); r.s = 0; // assumes a,this >= 0 r.t = i; - while(i > 0) r_array[--i] = 0; + while (i > 0) r_array[--i] = 0; var j; - for(j = r.t-this.t; i < j; ++i) r_array[i+this.t] = this.am(0,a_array[i],r,i,0,this.t); - for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a_array[i],r,i,0,n-i); + for (j = r.t - this.t; i < j; ++i) + r_array[i + this.t] = this.am(0, a_array[i], r, i, 0, this.t); + for (j = Math.min(a.t, n); i < j; ++i) this.am(0, a_array[i], r, i, 0, n - i); r.clamp(); } // (protected) r = "this * a" without lower n words, n > 0 // "this" should be the larger one if appropriate. -function bnpMultiplyUpperTo(a,n,r) { +function bnpMultiplyUpperTo(a, n, r) { var r_array = r.array; var a_array = a.array; --n; - var i = r.t = this.t+a.t-n; + var i = (r.t = this.t + a.t - n); r.s = 0; // assumes a,this >= 0 - while(--i >= 0) r_array[i] = 0; - for(i = Math.max(n-this.t,0); i < a.t; ++i) - r_array[this.t+i-n] = this.am(n-i,a_array[i],r,0,0,this.t+i-n); + while (--i >= 0) r_array[i] = 0; + for (i = Math.max(n - this.t, 0); i < a.t; ++i) + r_array[this.t + i - n] = this.am( + n - i, + a_array[i], + r, + 0, + 0, + this.t + i - n + ); r.clamp(); - r.drShiftTo(1,r); + r.drShiftTo(1, r); } // Barrett modular reduction @@ -1058,35 +1279,51 @@ function Barrett(m) { // setup Barrett this.r2 = nbi(); this.q3 = nbi(); - BigInteger.ONE.dlShiftTo(2*m.t,this.r2); + BigInteger.ONE.dlShiftTo(2 * m.t, this.r2); this.mu = this.r2.divide(m); this.m = m; } function barrettConvert(x) { - if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); - else if(x.compareTo(this.m) < 0) return x; - else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } + if (x.s < 0 || x.t > 2 * this.m.t) return x.mod(this.m); + else if (x.compareTo(this.m) < 0) return x; + else { + var r = nbi(); + x.copyTo(r); + this.reduce(r); + return r; + } } -function barrettRevert(x) { return x; } +function barrettRevert(x) { + return x; +} // x = x mod m (HAC 14.42) function barrettReduce(x) { - x.drShiftTo(this.m.t-1,this.r2); - if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } - this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); - this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); - while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); - x.subTo(this.r2,x); - while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); + x.drShiftTo(this.m.t - 1, this.r2); + if (x.t > this.m.t + 1) { + x.t = this.m.t + 1; + x.clamp(); + } + this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3); + this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); + while (x.compareTo(this.r2) < 0) x.dAddOffset(1, this.m.t + 1); + x.subTo(this.r2, x); + while (x.compareTo(this.m) >= 0) x.subTo(this.m, x); } // r = x^2 mod m; x != r -function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } +function barrettSqrTo(x, r) { + x.squareTo(r); + this.reduce(r); +} // r = x*y mod m; x,y != r -function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } +function barrettMulTo(x, y, r) { + x.multiplyTo(y, r); + this.reduce(r); +} Barrett.prototype.convert = barrettConvert; Barrett.prototype.revert = barrettRevert; @@ -1095,60 +1332,88 @@ Barrett.prototype.mulTo = barrettMulTo; Barrett.prototype.sqrTo = barrettSqrTo; // (public) this^e % m (HAC 14.85) -function bnModPow(e,m) { +function bnModPow(e, m) { var e_array = e.array; - var i = e.bitLength(), k, r = nbv(1), z; - if(i <= 0) return r; - else if(i < 18) k = 1; - else if(i < 48) k = 3; - else if(i < 144) k = 4; - else if(i < 768) k = 5; + var i = e.bitLength(), + k, + r = nbv(1), + z; + if (i <= 0) return r; + else if (i < 18) k = 1; + else if (i < 48) k = 3; + else if (i < 144) k = 4; + else if (i < 768) k = 5; else k = 6; - if(i < 8) - z = new Classic(m); - else if(m.isEven()) - z = new Barrett(m); - else - z = new Montgomery(m); + if (i < 8) z = new Classic(m); + else if (m.isEven()) z = new Barrett(m); + else z = new Montgomery(m); // precomputation - var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { + if (k > 1) { var g2 = nbi(); - z.sqrTo(g[1],g2); - while(n <= km) { + z.sqrTo(g[1], g2); + while (n <= km) { g[n] = nbi(); - z.mulTo(g2,g[n-2],g[n]); + z.mulTo(g2, g[n - 2], g[n]); n += 2; } } - var j = e.t-1, w, is1 = true, r2 = nbi(), t; - i = nbits(e_array[j])-1; - while(j >= 0) { - if(i >= k1) w = (e_array[j]>>(i-k1))&km; + var j = e.t - 1, + w, + is1 = true, + r2 = nbi(), + t; + i = nbits(e_array[j]) - 1; + while (j >= 0) { + if (i >= k1) w = (e_array[j] >> (i - k1)) & km; else { - w = (e_array[j]&((1<<(i+1))-1))<<(k1-i); - if(j > 0) w |= e_array[j-1]>>(BI_DB+i-k1); + w = (e_array[j] & ((1 << (i + 1)) - 1)) << (k1 - i); + if (j > 0) w |= e_array[j - 1] >> (BI_DB + i - k1); } n = k; - while((w&1) == 0) { w >>= 1; --n; } - if((i -= n) < 0) { i += BI_DB; --j; } - if(is1) { // ret == 1, don't bother squaring or multiplying it + while ((w & 1) == 0) { + w >>= 1; + --n; + } + if ((i -= n) < 0) { + i += BI_DB; + --j; + } + if (is1) { + // ret == 1, don't bother squaring or multiplying it g[w].copyTo(r); is1 = false; - } - else { - while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } - if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } - z.mulTo(r2,g[w],r); + } else { + while (n > 1) { + z.sqrTo(r, r2); + z.sqrTo(r2, r); + n -= 2; + } + if (n > 0) z.sqrTo(r, r2); + else { + t = r; + r = r2; + r2 = t; + } + z.mulTo(r2, g[w], r); } - while(j >= 0 && (e_array[j]&(1<= 0 && (e_array[j] & (1 << i)) == 0) { + z.sqrTo(r, r2); + t = r; + r = r2; + r2 = t; + if (--i < 0) { + i = BI_DB - 1; + --j; + } } } return z.revert(r); @@ -1156,104 +1421,128 @@ function bnModPow(e,m) { // (public) gcd(this,a) (HAC 14.54) function bnGCD(a) { - var x = (this.s<0)?this.negate():this.clone(); - var y = (a.s<0)?a.negate():a.clone(); - if(x.compareTo(y) < 0) { var t = x; x = y; y = t; } - var i = x.getLowestSetBit(), g = y.getLowestSetBit(); - if(g < 0) return x; - if(i < g) g = i; - if(g > 0) { - x.rShiftTo(g,x); - y.rShiftTo(g,y); + var x = this.s < 0 ? this.negate() : this.clone(); + var y = a.s < 0 ? a.negate() : a.clone(); + if (x.compareTo(y) < 0) { + var t = x; + x = y; + y = t; } - while(x.signum() > 0) { - if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); - if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); - if(x.compareTo(y) >= 0) { - x.subTo(y,x); - x.rShiftTo(1,x); - } - else { - y.subTo(x,y); - y.rShiftTo(1,y); + var i = x.getLowestSetBit(), + g = y.getLowestSetBit(); + if (g < 0) return x; + if (i < g) g = i; + if (g > 0) { + x.rShiftTo(g, x); + y.rShiftTo(g, y); + } + while (x.signum() > 0) { + if ((i = x.getLowestSetBit()) > 0) x.rShiftTo(i, x); + if ((i = y.getLowestSetBit()) > 0) y.rShiftTo(i, y); + if (x.compareTo(y) >= 0) { + x.subTo(y, x); + x.rShiftTo(1, x); + } else { + y.subTo(x, y); + y.rShiftTo(1, y); } } - if(g > 0) y.lShiftTo(g,y); + if (g > 0) y.lShiftTo(g, y); return y; } // (protected) this % n, n < 2^26 function bnpModInt(n) { var this_array = this.array; - if(n <= 0) return 0; - var d = BI_DV%n, r = (this.s<0)?n-1:0; - if(this.t > 0) - if(d == 0) r = this_array[0]%n; - else for(var i = this.t-1; i >= 0; --i) r = (d*r+this_array[i])%n; + if (n <= 0) return 0; + var d = BI_DV % n, + r = this.s < 0 ? n - 1 : 0; + if (this.t > 0) + if (d == 0) r = this_array[0] % n; + else for (var i = this.t - 1; i >= 0; --i) r = (d * r + this_array[i]) % n; return r; } // (public) 1/this % m (HAC 14.61) function bnModInverse(m) { var ac = m.isEven(); - if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; - var u = m.clone(), v = this.clone(); - var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); - while(u.signum() != 0) { - while(u.isEven()) { - u.rShiftTo(1,u); - if(ac) { - if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } - a.rShiftTo(1,a); - } - else if(!b.isEven()) b.subTo(m,b); - b.rShiftTo(1,b); + if ((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; + var u = m.clone(), + v = this.clone(); + var a = nbv(1), + b = nbv(0), + c = nbv(0), + d = nbv(1); + while (u.signum() != 0) { + while (u.isEven()) { + u.rShiftTo(1, u); + if (ac) { + if (!a.isEven() || !b.isEven()) { + a.addTo(this, a); + b.subTo(m, b); + } + a.rShiftTo(1, a); + } else if (!b.isEven()) b.subTo(m, b); + b.rShiftTo(1, b); } - while(v.isEven()) { - v.rShiftTo(1,v); - if(ac) { - if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } - c.rShiftTo(1,c); - } - else if(!d.isEven()) d.subTo(m,d); - d.rShiftTo(1,d); + while (v.isEven()) { + v.rShiftTo(1, v); + if (ac) { + if (!c.isEven() || !d.isEven()) { + c.addTo(this, c); + d.subTo(m, d); + } + c.rShiftTo(1, c); + } else if (!d.isEven()) d.subTo(m, d); + d.rShiftTo(1, d); } - if(u.compareTo(v) >= 0) { - u.subTo(v,u); - if(ac) a.subTo(c,a); - b.subTo(d,b); - } - else { - v.subTo(u,v); - if(ac) c.subTo(a,c); - d.subTo(b,d); + if (u.compareTo(v) >= 0) { + u.subTo(v, u); + if (ac) a.subTo(c, a); + b.subTo(d, b); + } else { + v.subTo(u, v); + if (ac) c.subTo(a, c); + d.subTo(b, d); } } - if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; - if(d.compareTo(m) >= 0) return d.subtract(m); - if(d.signum() < 0) d.addTo(m,d); else return d; - if(d.signum() < 0) return d.add(m); else return d; -} - -var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509]; -var lplim = (1<<26)/lowprimes[lowprimes.length-1]; + if (v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; + if (d.compareTo(m) >= 0) return d.subtract(m); + if (d.signum() < 0) d.addTo(m, d); + else return d; + if (d.signum() < 0) return d.add(m); + else return d; +} + +var lowprimes = [ + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, + 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, + 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, + 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, + 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, + 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, + 509, +]; +var lplim = (1 << 26) / lowprimes[lowprimes.length - 1]; // (public) test primality with certainty >= 1-.5^t function bnIsProbablePrime(t) { - var i, x = this.abs(); + var i, + x = this.abs(); var x_array = x.array; - if(x.t == 1 && x_array[0] <= lowprimes[lowprimes.length-1]) { - for(i = 0; i < lowprimes.length; ++i) - if(x_array[0] == lowprimes[i]) return true; + if (x.t == 1 && x_array[0] <= lowprimes[lowprimes.length - 1]) { + for (i = 0; i < lowprimes.length; ++i) + if (x_array[0] == lowprimes[i]) return true; return false; } - if(x.isEven()) return false; + if (x.isEven()) return false; i = 1; - while(i < lowprimes.length) { - var m = lowprimes[i], j = i+1; - while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; + while (i < lowprimes.length) { + var m = lowprimes[i], + j = i + 1; + while (j < lowprimes.length && m < lplim) m *= lowprimes[j++]; m = x.modInt(m); - while(i < j) if(m%lowprimes[i++] == 0) return false; + while (i < j) if (m % lowprimes[i++] == 0) return false; } return x.millerRabin(t); } @@ -1262,21 +1551,21 @@ function bnIsProbablePrime(t) { function bnpMillerRabin(t) { var n1 = this.subtract(BigInteger.ONE); var k = n1.getLowestSetBit(); - if(k <= 0) return false; + if (k <= 0) return false; var r = n1.shiftRight(k); - t = (t+1)>>1; - if(t > lowprimes.length) t = lowprimes.length; + t = (t + 1) >> 1; + if (t > lowprimes.length) t = lowprimes.length; var a = nbi(); - for(var i = 0; i < t; ++i) { + for (var i = 0; i < t; ++i) { a.fromInt(lowprimes[i]); - var y = a.modPow(r,this); - if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { + var y = a.modPow(r, this); + if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { var j = 1; - while(j++ < k && y.compareTo(n1) != 0) { - y = y.modPowInt(2,this); - if(y.compareTo(BigInteger.ONE) == 0) return false; + while (j++ < k && y.compareTo(n1) != 0) { + y = y.modPowInt(2, this); + if (y.compareTo(BigInteger.ONE) == 0) return false; } - if(y.compareTo(n1) != 0) return false; + if (y.compareTo(n1) != 0) return false; } } return true; @@ -1351,10 +1640,9 @@ function Arcfour() { // Initialize arcfour context from key, an array of ints, each from [0..255] function ARC4init(key) { var i, j, t; - for(i = 0; i < 256; ++i) - this.S[i] = i; + for (i = 0; i < 256; ++i) this.S[i] = i; j = 0; - for(i = 0; i < 256; ++i) { + for (i = 0; i < 256; ++i) { j = (j + this.S[i] + key[i % key.length]) & 255; t = this.S[i]; this.S[i] = this.S[j]; @@ -1401,7 +1689,7 @@ function rng_seed_int(x) { rng_pool[rng_pptr++] ^= (x >> 8) & 255; rng_pool[rng_pptr++] ^= (x >> 16) & 255; rng_pool[rng_pptr++] ^= (x >> 24) & 255; - if(rng_pptr >= rng_psize) rng_pptr -= rng_psize; + if (rng_pptr >= rng_psize) rng_pptr -= rng_psize; } // Mix in the current time (w/milliseconds) into the pool @@ -1412,11 +1700,12 @@ function rng_seed_time() { } // Initialize the pool with junk if needed. -if(rng_pool == null) { +if (rng_pool == null) { rng_pool = new Array(); rng_pptr = 0; var t; - while(rng_pptr < rng_psize) { // extract some randomness from Math.random() + while (rng_pptr < rng_psize) { + // extract some randomness from Math.random() t = Math.floor(65536 * Math.random()); rng_pool[rng_pptr++] = t >>> 8; rng_pool[rng_pptr++] = t & 255; @@ -1428,11 +1717,11 @@ if(rng_pool == null) { } function rng_get_byte() { - if(rng_state == null) { + if (rng_state == null) { rng_seed_time(); rng_state = prng_newstate(); rng_state.init(rng_pool); - for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) + for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) rng_pool[rng_pptr] = 0; rng_pptr = 0; //rng_pool = null; @@ -1443,7 +1732,7 @@ function rng_get_byte() { function rng_get_bytes(ba) { var i; - for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte(); + for (i = 0; i < ba.length; ++i) ba[i] = rng_get_byte(); } function SecureRandom() {} @@ -1452,42 +1741,41 @@ SecureRandom.prototype.nextBytes = rng_get_bytes; // Depends on jsbn.js and rng.js // convert a (hex) string to a bignum object -function parseBigInt(str,r) { - return new BigInteger(str,r); +function parseBigInt(str, r) { + return new BigInteger(str, r); } -function linebrk(s,n) { +function linebrk(s, n) { var ret = ""; var i = 0; - while(i + n < s.length) { - ret += s.substring(i,i+n) + "\n"; + while (i + n < s.length) { + ret += s.substring(i, i + n) + "\n"; i += n; } - return ret + s.substring(i,s.length); + return ret + s.substring(i, s.length); } function byte2Hex(b) { - if(b < 0x10) - return "0" + b.toString(16); - else - return b.toString(16); + if (b < 0x10) return "0" + b.toString(16); + else return b.toString(16); } // PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint -function pkcs1pad2(s,n) { - if(n < s.length + 11) { +function pkcs1pad2(s, n) { + if (n < s.length + 11) { alert("Message too long for RSA"); return null; } var ba = new Array(); var i = s.length - 1; - while(i >= 0 && n > 0) ba[--n] = s.charCodeAt(i--); + while (i >= 0 && n > 0) ba[--n] = s.charCodeAt(i--); ba[--n] = 0; var rng = new SecureRandom(); var x = new Array(); - while(n > 2) { // random non-zero pad + while (n > 2) { + // random non-zero pad x[0] = 0; - while(x[0] == 0) rng.nextBytes(x); + while (x[0] == 0) rng.nextBytes(x); ba[--n] = x[0]; } ba[--n] = 2; @@ -1508,13 +1796,11 @@ function RSAKey() { } // Set the public key fields N and e from hex strings -function RSASetPublic(N,E) { - if(N != null && E != null && N.length > 0 && E.length > 0) { - this.n = parseBigInt(N,16); - this.e = parseInt(E,16); - } - else - alert("Invalid RSA public key"); +function RSASetPublic(N, E) { + if (N != null && E != null && N.length > 0 && E.length > 0) { + this.n = parseBigInt(N, 16); + this.e = parseInt(E, 16); + } else alert("Invalid RSA public key"); } // Perform raw public operation on "x": return x^e (mod n) @@ -1524,12 +1810,13 @@ function RSADoPublic(x) { // Return the PKCS#1 RSA encryption of "text" as an even-length hex string function RSAEncrypt(text) { - var m = pkcs1pad2(text,(this.n.bitLength()+7)>>3); - if(m == null) return null; + var m = pkcs1pad2(text, (this.n.bitLength() + 7) >> 3); + if (m == null) return null; var c = this.doPublic(m); - if(c == null) return null; + if (c == null) return null; var h = c.toString(16); - if((h.length & 1) == 0) return h; else return "0" + h; + if ((h.length & 1) == 0) return h; + else return "0" + h; } // Return the PKCS#1 RSA encryption of "text" as a Base64-encoded string @@ -1548,64 +1835,67 @@ RSAKey.prototype.encrypt = RSAEncrypt; // Depends on rsa.js and jsbn2.js // Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext -function pkcs1unpad2(d,n) { +function pkcs1unpad2(d, n) { var b = d.toByteArray(); var i = 0; - while(i < b.length && b[i] == 0) ++i; - if(b.length-i != n-1 || b[i] != 2) - return null; + while (i < b.length && b[i] == 0) ++i; + if (b.length - i != n - 1 || b[i] != 2) return null; ++i; - while(b[i] != 0) - if(++i >= b.length) return null; + while (b[i] != 0) if (++i >= b.length) return null; var ret = ""; - while(++i < b.length) - ret += String.fromCharCode(b[i]); + while (++i < b.length) ret += String.fromCharCode(b[i]); return ret; } // Set the private key fields N, e, and d from hex strings -function RSASetPrivate(N,E,D) { - if(N != null && E != null && N.length > 0 && E.length > 0) { - this.n = parseBigInt(N,16); - this.e = parseInt(E,16); - this.d = parseBigInt(D,16); - } - else - alert("Invalid RSA private key"); +function RSASetPrivate(N, E, D) { + if (N != null && E != null && N.length > 0 && E.length > 0) { + this.n = parseBigInt(N, 16); + this.e = parseInt(E, 16); + this.d = parseBigInt(D, 16); + } else alert("Invalid RSA private key"); } // Set the private key fields N, e, d and CRT params from hex strings -function RSASetPrivateEx(N,E,D,P,Q,DP,DQ,C) { - if(N != null && E != null && N.length > 0 && E.length > 0) { - this.n = parseBigInt(N,16); - this.e = parseInt(E,16); - this.d = parseBigInt(D,16); - this.p = parseBigInt(P,16); - this.q = parseBigInt(Q,16); - this.dmp1 = parseBigInt(DP,16); - this.dmq1 = parseBigInt(DQ,16); - this.coeff = parseBigInt(C,16); - } - else - alert("Invalid RSA private key"); +function RSASetPrivateEx(N, E, D, P, Q, DP, DQ, C) { + if (N != null && E != null && N.length > 0 && E.length > 0) { + this.n = parseBigInt(N, 16); + this.e = parseInt(E, 16); + this.d = parseBigInt(D, 16); + this.p = parseBigInt(P, 16); + this.q = parseBigInt(Q, 16); + this.dmp1 = parseBigInt(DP, 16); + this.dmq1 = parseBigInt(DQ, 16); + this.coeff = parseBigInt(C, 16); + } else alert("Invalid RSA private key"); } // Generate a new random private key B bits long, using public expt E -function RSAGenerate(B,E) { +function RSAGenerate(B, E) { var rng = new SecureRandom(); - var qs = B>>1; - this.e = parseInt(E,16); - var ee = new BigInteger(E,16); - for(;;) { - for(;;) { - this.p = new BigInteger(B-qs,1,rng); - if(this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) break; + var qs = B >> 1; + this.e = parseInt(E, 16); + var ee = new BigInteger(E, 16); + for (;;) { + for (;;) { + this.p = new BigInteger(B - qs, 1, rng); + if ( + this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == + 0 && + this.p.isProbablePrime(10) + ) + break; } - for(;;) { - this.q = new BigInteger(qs,1,rng); - if(this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) break; + for (;;) { + this.q = new BigInteger(qs, 1, rng); + if ( + this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == + 0 && + this.q.isProbablePrime(10) + ) + break; } - if(this.p.compareTo(this.q) <= 0) { + if (this.p.compareTo(this.q) <= 0) { var t = this.p; this.p = this.q; this.q = t; @@ -1613,7 +1903,7 @@ function RSAGenerate(B,E) { var p1 = this.p.subtract(BigInteger.ONE); var q1 = this.q.subtract(BigInteger.ONE); var phi = p1.multiply(q1); - if(phi.gcd(ee).compareTo(BigInteger.ONE) == 0) { + if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) { this.n = this.p.multiply(this.q); this.d = ee.modInverse(phi); this.dmp1 = this.d.mod(p1); @@ -1626,16 +1916,19 @@ function RSAGenerate(B,E) { // Perform raw private operation on "x": return x^d (mod n) function RSADoPrivate(x) { - if(this.p == null || this.q == null) - return x.modPow(this.d, this.n); + if (this.p == null || this.q == null) return x.modPow(this.d, this.n); // TODO: re-calculate any missing CRT params var xp = x.mod(this.p).modPow(this.dmp1, this.p); var xq = x.mod(this.q).modPow(this.dmq1, this.q); - while(xp.compareTo(xq) < 0) - xp = xp.add(this.p); - return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq); + while (xp.compareTo(xq) < 0) xp = xp.add(this.p); + return xp + .subtract(xq) + .multiply(this.coeff) + .mod(this.p) + .multiply(this.q) + .add(xq); } // Return the PKCS#1 RSA decryption of "ctext". @@ -1643,8 +1936,8 @@ function RSADoPrivate(x) { function RSADecrypt(ctext) { var c = parseBigInt(ctext, 16); var m = this.doPrivate(c); - if(m == null) return null; - return pkcs1unpad2(m, (this.n.bitLength()+7)>>3); + if (m == null) return null; + return pkcs1unpad2(m, (this.n.bitLength() + 7) >> 3); } // Return the PKCS#1 RSA decryption of "ctext". @@ -1664,33 +1957,58 @@ RSAKey.prototype.generate = RSAGenerate; RSAKey.prototype.decrypt = RSADecrypt; //RSAKey.prototype.b64_decrypt = RSAB64Decrypt; - -nValue="a5261939975948bb7a58dffe5ff54e65f0498f9175f5a09288810b8975871e99af3b5dd94057b0fc07535f5f97444504fa35169d461d0d30cf0192e307727c065168c788771c561a9400fb49175e9e6aa4e23fe11af69e9412dd23b0cb6684c4c2429bce139e848ab26d0829073351f4acd36074eafd036a5eb83359d2a698d3"; -eValue="10001"; -dValue="8e9912f6d3645894e8d38cb58c0db81ff516cf4c7e5a14c7f1eddb1459d2cded4d8d293fc97aee6aefb861859c8b6a3d1dfe710463e1f9ddc72048c09751971c4a580aa51eb523357a3cc48d31cfad1d4a165066ed92d4748fb6571211da5cb14bc11b6e2df7c1a559e6d5ac1cd5c94703a22891464fba23d0d965086277a161"; -pValue="d090ce58a92c75233a6486cb0a9209bf3583b64f540c76f5294bb97d285eed33aec220bde14b2417951178ac152ceab6da7090905b478195498b352048f15e7d"; -qValue="cab575dc652bb66df15a0359609d51d1db184750c00c6698b90ef3465c99655103edbf0d54c56aec0ce3c4d22592338092a126a0cc49f65a4a30d222b411e58f"; -dmp1Value="1a24bca8e273df2f0e47c199bbf678604e7df7215480c77c8db39f49b000ce2cf7500038acfff5433b7d582a01f1826e6f4d42e1c57f5e1fef7b12aabc59fd25"; -dmq1Value="3d06982efbbe47339e1f6d36b1216b8a741d410b0c662f54f7118b27b9a4ec9d914337eb39841d8666f3034408cf94f5b62f11c402fc994fe15a05493150d9fd"; -coeffValue="3a3e731acd8960b7ff9eb81a7ff93bd1cfa74cbd56987db58b4594fb09c09084db1734c8143f98b602b981aaa9243ca28deb69b5b280ee8dcee0fd2625e53250"; +nValue = + "a5261939975948bb7a58dffe5ff54e65f0498f9175f5a09288810b8975871e99af3b5dd94057b0fc07535f5f97444504fa35169d461d0d30cf0192e307727c065168c788771c561a9400fb49175e9e6aa4e23fe11af69e9412dd23b0cb6684c4c2429bce139e848ab26d0829073351f4acd36074eafd036a5eb83359d2a698d3"; +eValue = "10001"; +dValue = + "8e9912f6d3645894e8d38cb58c0db81ff516cf4c7e5a14c7f1eddb1459d2cded4d8d293fc97aee6aefb861859c8b6a3d1dfe710463e1f9ddc72048c09751971c4a580aa51eb523357a3cc48d31cfad1d4a165066ed92d4748fb6571211da5cb14bc11b6e2df7c1a559e6d5ac1cd5c94703a22891464fba23d0d965086277a161"; +pValue = + "d090ce58a92c75233a6486cb0a9209bf3583b64f540c76f5294bb97d285eed33aec220bde14b2417951178ac152ceab6da7090905b478195498b352048f15e7d"; +qValue = + "cab575dc652bb66df15a0359609d51d1db184750c00c6698b90ef3465c99655103edbf0d54c56aec0ce3c4d22592338092a126a0cc49f65a4a30d222b411e58f"; +dmp1Value = + "1a24bca8e273df2f0e47c199bbf678604e7df7215480c77c8db39f49b000ce2cf7500038acfff5433b7d582a01f1826e6f4d42e1c57f5e1fef7b12aabc59fd25"; +dmq1Value = + "3d06982efbbe47339e1f6d36b1216b8a741d410b0c662f54f7118b27b9a4ec9d914337eb39841d8666f3034408cf94f5b62f11c402fc994fe15a05493150d9fd"; +coeffValue = + "3a3e731acd8960b7ff9eb81a7ff93bd1cfa74cbd56987db58b4594fb09c09084db1734c8143f98b602b981aaa9243ca28deb69b5b280ee8dcee0fd2625e53250"; setupEngine(am3, 28); -var TEXT = "The quick brown fox jumped over the extremely lazy frog! " + - "Now is the time for all good men to come to the party."; +var TEXT = + "The quick brown fox jumped over the extremely lazy frog! " + + "Now is the time for all good men to come to the party."; var encrypted; function encrypt() { var RSA = new RSAKey(); RSA.setPublic(nValue, eValue); - RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue); + RSA.setPrivateEx( + nValue, + eValue, + dValue, + pValue, + qValue, + dmp1Value, + dmq1Value, + coeffValue + ); encrypted = RSA.encrypt(TEXT); } function decrypt() { var RSA = new RSAKey(); RSA.setPublic(nValue, eValue); - RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue); + RSA.setPrivateEx( + nValue, + eValue, + dValue, + pValue, + qValue, + dmp1Value, + dmq1Value, + coeffValue + ); var decrypted = RSA.decrypt(encrypted); if (decrypted != TEXT) { throw new Error("Crypto operation failed"); diff --git a/benchmarks/v8-v7/deltablue.js b/benchmarks/v8-v7/deltablue.js index 548fd96ffb..d8b28e2052 100644 --- a/benchmarks/v8-v7/deltablue.js +++ b/benchmarks/v8-v7/deltablue.js @@ -15,19 +15,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - // This implementation of the DeltaBlue benchmark is derived // from the Smalltalk implementation by John Maloney and Mario // Wolczko. Some parts have been translated directly, whereas // others have been modified more aggresively to make it feel // more like a JavaScript program. - -var DeltaBlue = new BenchmarkSuite('DeltaBlue', 66118, [ - new Benchmark('DeltaBlue', deltaBlue) +var DeltaBlue = new BenchmarkSuite("DeltaBlue", 66118, [ + new Benchmark("DeltaBlue", deltaBlue), ]); - /** * A JavaScript implementation of the DeltaBlue constraint-solving * algorithm, as described in: @@ -43,15 +40,14 @@ var DeltaBlue = new BenchmarkSuite('DeltaBlue', 66118, [ * implementation. */ - /* --- O b j e c t M o d e l --- */ Object.prototype.inheritsFrom = function (shuper) { - function Inheriter() { } + function Inheriter() {} Inheriter.prototype = shuper.prototype; this.prototype = new Inheriter(); this.superConstructor = shuper; -} +}; function OrderedCollection() { this.elms = new Array(); @@ -59,22 +55,23 @@ function OrderedCollection() { OrderedCollection.prototype.add = function (elm) { this.elms.push(elm); -} +}; OrderedCollection.prototype.at = function (index) { return this.elms[index]; -} +}; OrderedCollection.prototype.size = function () { return this.elms.length; -} +}; OrderedCollection.prototype.removeFirst = function () { return this.elms.pop(); -} +}; OrderedCollection.prototype.remove = function (elm) { - var index = 0, skipped = 0; + var index = 0, + skipped = 0; for (var i = 0; i < this.elms.length; i++) { var value = this.elms[i]; if (value != elm) { @@ -84,9 +81,8 @@ OrderedCollection.prototype.remove = function (elm) { skipped++; } } - for (var i = 0; i < skipped; i++) - this.elms.pop(); -} + for (var i = 0; i < skipped; i++) this.elms.pop(); +}; /* --- * * S t r e n g t h @@ -105,39 +101,45 @@ function Strength(strengthValue, name) { Strength.stronger = function (s1, s2) { return s1.strengthValue < s2.strengthValue; -} +}; Strength.weaker = function (s1, s2) { return s1.strengthValue > s2.strengthValue; -} +}; Strength.weakestOf = function (s1, s2) { return this.weaker(s1, s2) ? s1 : s2; -} +}; Strength.strongest = function (s1, s2) { return this.stronger(s1, s2) ? s1 : s2; -} +}; Strength.prototype.nextWeaker = function () { switch (this.strengthValue) { - case 0: return Strength.WEAKEST; - case 1: return Strength.WEAK_DEFAULT; - case 2: return Strength.NORMAL; - case 3: return Strength.STRONG_DEFAULT; - case 4: return Strength.PREFERRED; - case 5: return Strength.REQUIRED; + case 0: + return Strength.WEAKEST; + case 1: + return Strength.WEAK_DEFAULT; + case 2: + return Strength.NORMAL; + case 3: + return Strength.STRONG_DEFAULT; + case 4: + return Strength.PREFERRED; + case 5: + return Strength.REQUIRED; } -} +}; // Strength constants. -Strength.REQUIRED = new Strength(0, "required"); +Strength.REQUIRED = new Strength(0, "required"); Strength.STONG_PREFERRED = new Strength(1, "strongPreferred"); -Strength.PREFERRED = new Strength(2, "preferred"); -Strength.STRONG_DEFAULT = new Strength(3, "strongDefault"); -Strength.NORMAL = new Strength(4, "normal"); -Strength.WEAK_DEFAULT = new Strength(5, "weakDefault"); -Strength.WEAKEST = new Strength(6, "weakest"); +Strength.PREFERRED = new Strength(2, "preferred"); +Strength.STRONG_DEFAULT = new Strength(3, "strongDefault"); +Strength.NORMAL = new Strength(4, "normal"); +Strength.WEAK_DEFAULT = new Strength(5, "weakDefault"); +Strength.WEAKEST = new Strength(6, "weakest"); /* --- * * C o n s t r a i n t @@ -160,7 +162,7 @@ function Constraint(strength) { Constraint.prototype.addConstraint = function () { this.addToGraph(); planner.incrementalAdd(this); -} +}; /** * Attempt to find a way to enforce this constraint. If successful, @@ -181,16 +183,15 @@ Constraint.prototype.satisfy = function (mark) { var overridden = out.determinedBy; if (overridden != null) overridden.markUnsatisfied(); out.determinedBy = this; - if (!planner.addPropagate(this, mark)) - alert("Cycle encountered"); + if (!planner.addPropagate(this, mark)) alert("Cycle encountered"); out.mark = mark; return overridden; -} +}; Constraint.prototype.destroyConstraint = function () { if (this.isSatisfied()) planner.incrementalRemove(this); else this.removeFromGraph(); -} +}; /** * Normal constraints are not input constraints. An input constraint @@ -199,7 +200,7 @@ Constraint.prototype.destroyConstraint = function () { */ Constraint.prototype.isInput = function () { return false; -} +}; /* --- * * U n a r y C o n s t r a i n t @@ -224,34 +225,35 @@ UnaryConstraint.inheritsFrom(Constraint); UnaryConstraint.prototype.addToGraph = function () { this.myOutput.addConstraint(this); this.satisfied = false; -} +}; /** * Decides if this constraint can be satisfied and records that * decision. */ UnaryConstraint.prototype.chooseMethod = function (mark) { - this.satisfied = (this.myOutput.mark != mark) - && Strength.stronger(this.strength, this.myOutput.walkStrength); -} + this.satisfied = + this.myOutput.mark != mark && + Strength.stronger(this.strength, this.myOutput.walkStrength); +}; /** * Returns true if this constraint is satisfied in the current solution. */ UnaryConstraint.prototype.isSatisfied = function () { return this.satisfied; -} +}; UnaryConstraint.prototype.markInputs = function (mark) { // has no inputs -} +}; /** * Returns the current output variable. */ UnaryConstraint.prototype.output = function () { return this.myOutput; -} +}; /** * Calculate the walkabout strength, the stay flag, and, if it is @@ -262,23 +264,23 @@ UnaryConstraint.prototype.recalculate = function () { this.myOutput.walkStrength = this.strength; this.myOutput.stay = !this.isInput(); if (this.myOutput.stay) this.execute(); // Stay optimization -} +}; /** * Records that this constraint is unsatisfied */ UnaryConstraint.prototype.markUnsatisfied = function () { this.satisfied = false; -} +}; UnaryConstraint.prototype.inputsKnown = function () { return true; -} +}; UnaryConstraint.prototype.removeFromGraph = function () { if (this.myOutput != null) this.myOutput.removeConstraint(this); this.satisfied = false; -} +}; /* --- * * S t a y C o n s t r a i n t @@ -298,7 +300,7 @@ StayConstraint.inheritsFrom(UnaryConstraint); StayConstraint.prototype.execute = function () { // Stay constraints do nothing -} +}; /* --- * * E d i t C o n s t r a i n t @@ -319,19 +321,19 @@ EditConstraint.inheritsFrom(UnaryConstraint); */ EditConstraint.prototype.isInput = function () { return true; -} +}; EditConstraint.prototype.execute = function () { // Edit constraints do nothing -} +}; /* --- * * B i n a r y C o n s t r a i n t * --- */ var Direction = new Object(); -Direction.NONE = 0; -Direction.FORWARD = 1; +Direction.NONE = 0; +Direction.FORWARD = 1; Direction.BACKWARD = -1; /** @@ -355,14 +357,18 @@ BinaryConstraint.inheritsFrom(Constraint); */ BinaryConstraint.prototype.chooseMethod = function (mark) { if (this.v1.mark == mark) { - this.direction = (this.v2.mark != mark && Strength.stronger(this.strength, this.v2.walkStrength)) - ? Direction.FORWARD - : Direction.NONE; + this.direction = + this.v2.mark != mark && + Strength.stronger(this.strength, this.v2.walkStrength) + ? Direction.FORWARD + : Direction.NONE; } if (this.v2.mark == mark) { - this.direction = (this.v1.mark != mark && Strength.stronger(this.strength, this.v1.walkStrength)) - ? Direction.BACKWARD - : Direction.NONE; + this.direction = + this.v1.mark != mark && + Strength.stronger(this.strength, this.v1.walkStrength) + ? Direction.BACKWARD + : Direction.NONE; } if (Strength.weaker(this.v1.walkStrength, this.v2.walkStrength)) { this.direction = Strength.stronger(this.strength, this.v1.walkStrength) @@ -371,9 +377,9 @@ BinaryConstraint.prototype.chooseMethod = function (mark) { } else { this.direction = Strength.stronger(this.strength, this.v2.walkStrength) ? Direction.FORWARD - : Direction.BACKWARD + : Direction.BACKWARD; } -} +}; /** * Add this constraint to the constraint graph @@ -382,35 +388,35 @@ BinaryConstraint.prototype.addToGraph = function () { this.v1.addConstraint(this); this.v2.addConstraint(this); this.direction = Direction.NONE; -} +}; /** * Answer true if this constraint is satisfied in the current solution. */ BinaryConstraint.prototype.isSatisfied = function () { return this.direction != Direction.NONE; -} +}; /** * Mark the input variable with the given mark. */ BinaryConstraint.prototype.markInputs = function (mark) { this.input().mark = mark; -} +}; /** * Returns the current input variable */ BinaryConstraint.prototype.input = function () { - return (this.direction == Direction.FORWARD) ? this.v1 : this.v2; -} + return this.direction == Direction.FORWARD ? this.v1 : this.v2; +}; /** * Returns the current output variable */ BinaryConstraint.prototype.output = function () { - return (this.direction == Direction.FORWARD) ? this.v2 : this.v1; -} + return this.direction == Direction.FORWARD ? this.v2 : this.v1; +}; /** * Calculate the walkabout strength, the stay flag, and, if it is @@ -418,29 +424,30 @@ BinaryConstraint.prototype.output = function () { * constraint. Assume this constraint is satisfied. */ BinaryConstraint.prototype.recalculate = function () { - var ihn = this.input(), out = this.output(); + var ihn = this.input(), + out = this.output(); out.walkStrength = Strength.weakestOf(this.strength, ihn.walkStrength); out.stay = ihn.stay; if (out.stay) this.execute(); -} +}; /** * Record the fact that this constraint is unsatisfied. */ BinaryConstraint.prototype.markUnsatisfied = function () { this.direction = Direction.NONE; -} +}; BinaryConstraint.prototype.inputsKnown = function (mark) { var i = this.input(); return i.mark == mark || i.stay || i.determinedBy == null; -} +}; BinaryConstraint.prototype.removeFromGraph = function () { if (this.v1 != null) this.v1.removeConstraint(this); if (this.v2 != null) this.v2.removeConstraint(this); this.direction = Direction.NONE; -} +}; /* --- * * S c a l e C o n s t r a i n t @@ -468,18 +475,18 @@ ScaleConstraint.prototype.addToGraph = function () { ScaleConstraint.superConstructor.prototype.addToGraph.call(this); this.scale.addConstraint(this); this.offset.addConstraint(this); -} +}; ScaleConstraint.prototype.removeFromGraph = function () { ScaleConstraint.superConstructor.prototype.removeFromGraph.call(this); if (this.scale != null) this.scale.removeConstraint(this); if (this.offset != null) this.offset.removeConstraint(this); -} +}; ScaleConstraint.prototype.markInputs = function (mark) { ScaleConstraint.superConstructor.prototype.markInputs.call(this, mark); this.scale.mark = this.offset.mark = mark; -} +}; /** * Enforce this constraint. Assume that it is satisfied. @@ -490,7 +497,7 @@ ScaleConstraint.prototype.execute = function () { } else { this.v1.value = (this.v2.value - this.offset.value) / this.scale.value; } -} +}; /** * Calculate the walkabout strength, the stay flag, and, if it is @@ -498,11 +505,12 @@ ScaleConstraint.prototype.execute = function () { * this constraint is satisfied. */ ScaleConstraint.prototype.recalculate = function () { - var ihn = this.input(), out = this.output(); + var ihn = this.input(), + out = this.output(); out.walkStrength = Strength.weakestOf(this.strength, ihn.walkStrength); out.stay = ihn.stay && this.scale.stay && this.offset.stay; if (out.stay) this.execute(); -} +}; /* --- * * E q u a l i t y C o n s t r a i n t @@ -522,7 +530,7 @@ EqualityConstraint.inheritsFrom(BinaryConstraint); */ EqualityConstraint.prototype.execute = function () { this.output().value = this.input().value; -} +}; /* --- * * V a r i a b l e @@ -550,7 +558,7 @@ function Variable(name, initialValue) { */ Variable.prototype.addConstraint = function (c) { this.constraints.add(c); -} +}; /** * Removes all traces of c from this variable. @@ -558,7 +566,7 @@ Variable.prototype.addConstraint = function (c) { Variable.prototype.removeConstraint = function (c) { this.constraints.remove(c); if (this.determinedBy == c) this.determinedBy = null; -} +}; /* --- * * P l a n n e r @@ -588,9 +596,8 @@ function Planner() { Planner.prototype.incrementalAdd = function (c) { var mark = this.newMark(); var overridden = c.satisfy(mark); - while (overridden != null) - overridden = overridden.satisfy(mark); -} + while (overridden != null) overridden = overridden.satisfy(mark); +}; /** * Entry point for retracting a constraint. Remove the given @@ -612,19 +619,18 @@ Planner.prototype.incrementalRemove = function (c) { do { for (var i = 0; i < unsatisfied.size(); i++) { var u = unsatisfied.at(i); - if (u.strength == strength) - this.incrementalAdd(u); + if (u.strength == strength) this.incrementalAdd(u); } strength = strength.nextWeaker(); } while (strength != Strength.WEAKEST); -} +}; /** * Select a previously unused mark value. */ Planner.prototype.newMark = function () { return ++this.currentMark; -} +}; /** * Extract a plan for resatisfaction starting from the given source @@ -658,7 +664,7 @@ Planner.prototype.makePlan = function (sources) { } } return plan; -} +}; /** * Extract a plan for resatisfying starting from the output of the @@ -673,7 +679,7 @@ Planner.prototype.extractPlanFromConstraints = function (constraints) { sources.add(c); } return this.makePlan(sources); -} +}; /** * Recompute the walkabout strengths and stay flags of all variables @@ -701,8 +707,7 @@ Planner.prototype.addPropagate = function (c, mark) { this.addConstraintsConsumingTo(d.output(), todo); } return true; -} - +}; /** * Update the walkabout strengths and stay flags of all variables @@ -720,8 +725,7 @@ Planner.prototype.removePropagateFrom = function (out) { var v = todo.removeFirst(); for (var i = 0; i < v.constraints.size(); i++) { var c = v.constraints.at(i); - if (!c.isSatisfied()) - unsatisfied.add(c); + if (!c.isSatisfied()) unsatisfied.add(c); } var determining = v.determinedBy; for (var i = 0; i < v.constraints.size(); i++) { @@ -733,17 +737,16 @@ Planner.prototype.removePropagateFrom = function (out) { } } return unsatisfied; -} +}; Planner.prototype.addConstraintsConsumingTo = function (v, coll) { var determining = v.determinedBy; var cc = v.constraints; for (var i = 0; i < cc.size(); i++) { var c = cc.at(i); - if (c != determining && c.isSatisfied()) - coll.add(c); + if (c != determining && c.isSatisfied()) coll.add(c); } -} +}; /* --- * * P l a n @@ -760,22 +763,22 @@ function Plan() { Plan.prototype.addConstraint = function (c) { this.v.add(c); -} +}; Plan.prototype.size = function () { return this.v.size(); -} +}; Plan.prototype.constraintAt = function (index) { return this.v.at(index); -} +}; Plan.prototype.execute = function () { for (var i = 0; i < this.size(); i++) { var c = this.constraintAt(i); c.execute(); } -} +}; /* --- * * M a i n @@ -796,14 +799,15 @@ Plan.prototype.execute = function () { */ function chainTest(n) { planner = new Planner(); - var prev = null, first = null, last = null; + var prev = null, + first = null, + last = null; // Build chain of n equality constraints for (var i = 0; i <= n; i++) { var name = "v" + i; var v = new Variable(name); - if (prev != null) - new EqualityConstraint(prev, v, Strength.REQUIRED); + if (prev != null) new EqualityConstraint(prev, v, Strength.REQUIRED); if (i == 0) first = v; if (i == n) last = v; prev = v; @@ -817,8 +821,7 @@ function chainTest(n) { for (var i = 0; i < 100; i++) { first.value = i; plan.execute(); - if (last.value != i) - alert("Chain test failed."); + if (last.value != i) alert("Chain test failed."); } } @@ -832,7 +835,8 @@ function projectionTest(n) { planner = new Planner(); var scale = new Variable("scale", 10); var offset = new Variable("offset", 1000); - var src = null, dst = null; + var src = null, + dst = null; var dests = new OrderedCollection(); for (var i = 0; i < n; i++) { @@ -849,13 +853,11 @@ function projectionTest(n) { if (src.value != 5) alert("Projection 2 failed"); change(scale, 5); for (var i = 0; i < n - 1; i++) { - if (dests.at(i).value != i * 5 + 1000) - alert("Projection 3 failed"); + if (dests.at(i).value != i * 5 + 1000) alert("Projection 3 failed"); } change(offset, 2000); for (var i = 0; i < n - 1; i++) { - if (dests.at(i).value != i * 5 + 2000) - alert("Projection 4 failed"); + if (dests.at(i).value != i * 5 + 2000) alert("Projection 4 failed"); } } diff --git a/benchmarks/v8-v7/earley-boyer.js b/benchmarks/v8-v7/earley-boyer.js index b2328d6ba1..08167fb3ba 100644 --- a/benchmarks/v8-v7/earley-boyer.js +++ b/benchmarks/v8-v7/earley-boyer.js @@ -1,12 +1,15 @@ // This file is automatically generated by scheme2js, except for the // benchmark harness code at the beginning and end of the file. -var EarleyBoyer = new BenchmarkSuite('EarleyBoyer', 666463, [ - new Benchmark("Earley", function () { BgL_earleyzd2benchmarkzd2(); }), - new Benchmark("Boyer", function () { BgL_nboyerzd2benchmarkzd2(); }) +var EarleyBoyer = new BenchmarkSuite("EarleyBoyer", 666463, [ + new Benchmark("Earley", function () { + BgL_earleyzd2benchmarkzd2(); + }), + new Benchmark("Boyer", function () { + BgL_nboyerzd2benchmarkzd2(); + }), ]); - /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ @@ -44,96 +47,89 @@ function initRuntime() { } */ - function sc_print_debug() { - sc_print.apply(null, arguments); + sc_print.apply(null, arguments); } /*** META ((export *js*)) */ var sc_JS_GLOBALS = this; -var __sc_LINE=-1; -var __sc_FILE=""; +var __sc_LINE = -1; +var __sc_FILE = ""; /*** META ((export #t)) */ function sc_alert() { - var len = arguments.length; - var s = ""; - var i; + var len = arguments.length; + var s = ""; + var i; - for( i = 0; i < len; i++ ) { - s += sc_toDisplayString(arguments[ i ]); - } + for (i = 0; i < len; i++) { + s += sc_toDisplayString(arguments[i]); + } - return alert( s ); + return alert(s); } /*** META ((export #t)) */ -function sc_typeof( x ) { - return typeof x; +function sc_typeof(x) { + return typeof x; } /*** META ((export #t)) */ function sc_error() { - var a = [sc_jsstring2symbol("*error*")]; - for (var i = 0; i < arguments.length; i++) { - a[i+1] = arguments[i]; - } - throw a; + var a = [sc_jsstring2symbol("*error*")]; + for (var i = 0; i < arguments.length; i++) { + a[i + 1] = arguments[i]; + } + throw a; } /*** META ((export #t) (peephole (prefix "throw "))) */ function sc_raise(obj) { - throw obj; + throw obj; } /*** META ((export with-handler-lambda)) */ function sc_withHandlerLambda(handler, body) { - try { - return body(); - } catch(e) { - if (!e._internalException) - return handler(e); - else - throw e; - } + try { + return body(); + } catch (e) { + if (!e._internalException) return handler(e); + else throw e; + } } var sc_properties = new Object(); /*** META ((export #t)) */ function sc_putpropBang(sym, key, val) { - var ht = sc_properties[sym]; - if (!ht) { - ht = new Object(); - sc_properties[sym] = ht; - } - ht[key] = val; + var ht = sc_properties[sym]; + if (!ht) { + ht = new Object(); + sc_properties[sym] = ht; + } + ht[key] = val; } /*** META ((export #t)) */ function sc_getprop(sym, key) { - var ht = sc_properties[sym]; - if (ht) { - if (key in ht) - return ht[key]; - else - return false; - } else - return false; + var ht = sc_properties[sym]; + if (ht) { + if (key in ht) return ht[key]; + else return false; + } else return false; } /*** META ((export #t)) */ function sc_rempropBang(sym, key) { - var ht = sc_properties[sym]; - if (ht) - delete ht[key]; + var ht = sc_properties[sym]; + if (ht) delete ht[key]; } /*** META ((export #t)) */ function sc_any2String(o) { - return jsstring2string(sc_toDisplayString(o)); + return jsstring2string(sc_toDisplayString(o)); } /*** META ((export #t) @@ -141,7 +137,7 @@ function sc_any2String(o) { (type bool)) */ function sc_isEqv(o1, o2) { - return (o1 === o2); + return o1 === o2; } /*** META ((export #t) @@ -149,42 +145,42 @@ function sc_isEqv(o1, o2) { (type bool)) */ function sc_isEq(o1, o2) { - return (o1 === o2); + return o1 === o2; } /*** META ((export #t) (type bool)) */ function sc_isNumber(n) { - return (typeof n === "number"); + return typeof n === "number"; } /*** META ((export #t) (type bool)) */ function sc_isComplex(n) { - return sc_isNumber(n); + return sc_isNumber(n); } /*** META ((export #t) (type bool)) */ function sc_isReal(n) { - return sc_isNumber(n); + return sc_isNumber(n); } /*** META ((export #t) (type bool)) */ function sc_isRational(n) { - return sc_isReal(n); + return sc_isReal(n); } /*** META ((export #t) (type bool)) */ function sc_isInteger(n) { - return (parseInt(n) === n); + return parseInt(n) === n; } /*** META ((export #t) @@ -193,7 +189,7 @@ function sc_isInteger(n) { */ // we don't have exact numbers... function sc_isExact(n) { - return false; + return false; } /*** META ((export #t) @@ -201,7 +197,7 @@ function sc_isExact(n) { (type bool)) */ function sc_isInexact(n) { - return true; + return true; } /*** META ((export = =fx =fl) @@ -209,10 +205,9 @@ function sc_isInexact(n) { (peephole (infix 2 2 "==="))) */ function sc_equal(x) { - for (var i = 1; i < arguments.length; i++) - if (x !== arguments[i]) - return false; - return true; + for (var i = 1; i < arguments.length; i++) + if (x !== arguments[i]) return false; + return true; } /*** META ((export < = arguments[i]) - return false; - x = arguments[i]; - } - return true; + for (var i = 1; i < arguments.length; i++) { + if (x >= arguments[i]) return false; + x = arguments[i]; + } + return true; } /*** META ((export > >fx >fl) @@ -233,12 +227,11 @@ function sc_less(x) { (peephole (infix 2 2 ">"))) */ function sc_greater(x, y) { - for (var i = 1; i < arguments.length; i++) { - if (x <= arguments[i]) - return false; - x = arguments[i]; - } - return true; + for (var i = 1; i < arguments.length; i++) { + if (x <= arguments[i]) return false; + x = arguments[i]; + } + return true; } /*** META ((export <= <=fx <=fl) @@ -246,12 +239,11 @@ function sc_greater(x, y) { (peephole (infix 2 2 "<="))) */ function sc_lessEqual(x, y) { - for (var i = 1; i < arguments.length; i++) { - if (x > arguments[i]) - return false; - x = arguments[i]; - } - return true; + for (var i = 1; i < arguments.length; i++) { + if (x > arguments[i]) return false; + x = arguments[i]; + } + return true; } /*** META ((export >= >=fl >=fx) @@ -259,12 +251,11 @@ function sc_lessEqual(x, y) { (peephole (infix 2 2 ">="))) */ function sc_greaterEqual(x, y) { - for (var i = 1; i < arguments.length; i++) { - if (x < arguments[i]) - return false; - x = arguments[i]; - } - return true; + for (var i = 1; i < arguments.length; i++) { + if (x < arguments[i]) return false; + x = arguments[i]; + } + return true; } /*** META ((export #t) @@ -272,7 +263,7 @@ function sc_greaterEqual(x, y) { (peephole (postfix "=== 0"))) */ function sc_isZero(x) { - return (x === 0); + return x === 0; } /*** META ((export #t) @@ -280,7 +271,7 @@ function sc_isZero(x) { (peephole (postfix "> 0"))) */ function sc_isPositive(x) { - return (x > 0); + return x > 0; } /*** META ((export #t) @@ -288,7 +279,7 @@ function sc_isPositive(x) { (peephole (postfix "< 0"))) */ function sc_isNegative(x) { - return (x < 0); + return x < 0; } /*** META ((export #t) @@ -296,7 +287,7 @@ function sc_isNegative(x) { (peephole (postfix "%2===1"))) */ function sc_isOdd(x) { - return (x % 2 === 1); + return x % 2 === 1; } /*** META ((export #t) @@ -304,7 +295,7 @@ function sc_isOdd(x) { (peephole (postfix "%2===0"))) */ function sc_isEven(x) { - return (x % 2 === 0); + return x % 2 === 0; } /*** META ((export #t)) */ @@ -316,48 +307,42 @@ var sc_min = Math.min; (peephole (infix 0 #f "+" "0"))) */ function sc_plus() { - var sum = 0; - for (var i = 0; i < arguments.length; i++) - sum += arguments[i]; - return sum; + var sum = 0; + for (var i = 0; i < arguments.length; i++) sum += arguments[i]; + return sum; } /*** META ((export * *fx *fl) (peephole (infix 0 #f "*" "1"))) */ function sc_multi() { - var product = 1; - for (var i = 0; i < arguments.length; i++) - product *= arguments[i]; - return product; + var product = 1; + for (var i = 0; i < arguments.length; i++) product *= arguments[i]; + return product; } /*** META ((export - -fx -fl) (peephole (minus))) */ function sc_minus(x) { - if (arguments.length === 1) - return -x; - else { - var res = x; - for (var i = 1; i < arguments.length; i++) - res -= arguments[i]; - return res; - } + if (arguments.length === 1) return -x; + else { + var res = x; + for (var i = 1; i < arguments.length; i++) res -= arguments[i]; + return res; + } } /*** META ((export / /fl) (peephole (div))) */ function sc_div(x) { - if (arguments.length === 1) - return 1/x; - else { - var res = x; - for (var i = 1; i < arguments.length; i++) - res /= arguments[i]; - return res; - } + if (arguments.length === 1) return 1 / x; + else { + var res = x; + for (var i = 1; i < arguments.length; i++) res /= arguments[i]; + return res; + } } /*** META ((export #t)) */ @@ -367,60 +352,70 @@ var sc_abs = Math.abs; (peephole (hole 2 "parseInt(" x "/" y ")"))) */ function sc_quotient(x, y) { - return parseInt(x / y); + return parseInt(x / y); } /*** META ((export #t) (peephole (infix 2 2 "%"))) */ function sc_remainder(x, y) { - return x % y; + return x % y; } /*** META ((export #t) (peephole (modulo))) */ function sc_modulo(x, y) { - var remainder = x % y; - // if they don't have the same sign - if ((remainder * y) < 0) - return remainder + y; - else - return remainder; + var remainder = x % y; + // if they don't have the same sign + if (remainder * y < 0) return remainder + y; + else return remainder; } function sc_euclid_gcd(a, b) { - var temp; - if (a === 0) return b; - if (b === 0) return a; - if (a < 0) {a = -a;}; - if (b < 0) {b = -b;}; - if (b > a) {temp = a; a = b; b = temp;}; - while (true) { - a %= b; - if(a === 0) {return b;}; - b %= a; - if(b === 0) {return a;}; - }; - return b; + var temp; + if (a === 0) return b; + if (b === 0) return a; + if (a < 0) { + a = -a; + } + if (b < 0) { + b = -b; + } + if (b > a) { + temp = a; + a = b; + b = temp; + } + while (true) { + a %= b; + if (a === 0) { + return b; + } + b %= a; + if (b === 0) { + return a; + } + } + return b; } /*** META ((export #t)) */ function sc_gcd() { - var gcd = 0; - for (var i = 0; i < arguments.length; i++) - gcd = sc_euclid_gcd(gcd, arguments[i]); - return gcd; + var gcd = 0; + for (var i = 0; i < arguments.length; i++) + gcd = sc_euclid_gcd(gcd, arguments[i]); + return gcd; } /*** META ((export #t)) */ function sc_lcm() { - var lcm = 1; - for (var i = 0; i < arguments.length; i++) { - var f = Math.round(arguments[i] / sc_euclid_gcd(arguments[i], lcm)); - lcm *= Math.abs(f); - } - return lcm; + var lcm = 1; + for (var i = 0; i < arguments.length; i++) { + var f = Math.round(arguments[i] / sc_euclid_gcd(arguments[i], lcm)); + lcm *= Math.abs(f); + } + return lcm; } // LIMITATION: numerator and denominator don't make sense in floating point world. @@ -478,44 +473,44 @@ var sc_expt = Math.pow; (peephole (id))) */ function sc_exact2inexact(x) { - return x; + return x; } /*** META ((export #t) (peephole (id))) */ function sc_inexact2exact(x) { - return x; + return x; } function sc_number2jsstring(x, radix) { - if (radix) - return x.toString(radix); - else - return x.toString(); + if (radix) return x.toString(radix); + else return x.toString(); } function sc_jsstring2number(s, radix) { - if (s === "") return false; - - if (radix) { - var t = parseInt(s, radix); - if (!t && t !== 0) return false; - // verify that each char is in range. (parseInt ignores leading - // white and trailing chars) - var allowedChars = "01234567890abcdefghijklmnopqrstuvwxyz".substring(0, radix+1); - if ((new RegExp("^["+allowedChars+"]*$", "i")).test(s)) - return t; - else return false; - } else { - var t = +s; // does not ignore trailing chars. - if (!t && t !== 0) return false; - // simply verify that first char is not whitespace. - var c = s.charAt(0); - // if +c is 0, but the char is not "0", then we have a whitespace. - if (+c === 0 && c !== "0") return false; - return t; - } + if (s === "") return false; + + if (radix) { + var t = parseInt(s, radix); + if (!t && t !== 0) return false; + // verify that each char is in range. (parseInt ignores leading + // white and trailing chars) + var allowedChars = "01234567890abcdefghijklmnopqrstuvwxyz".substring( + 0, + radix + 1 + ); + if (new RegExp("^[" + allowedChars + "]*$", "i").test(s)) return t; + else return false; + } else { + var t = +s; // does not ignore trailing chars. + if (!t && t !== 0) return false; + // simply verify that first char is not whitespace. + var c = s.charAt(0); + // if +c is 0, but the char is not "0", then we have a whitespace. + if (+c === 0 && c !== "0") return false; + return t; + } } /*** META ((export #t) @@ -523,50 +518,50 @@ function sc_jsstring2number(s, radix) { (peephole (not))) */ function sc_not(b) { - return b === false; + return b === false; } /*** META ((export #t) (type bool)) */ function sc_isBoolean(b) { - return (b === true) || (b === false); + return b === true || b === false; } function sc_Pair(car, cdr) { - this.car = car; - this.cdr = cdr; + this.car = car; + this.cdr = cdr; } -sc_Pair.prototype.toString = function() { - return sc_toDisplayString(this); +sc_Pair.prototype.toString = function () { + return sc_toDisplayString(this); }; -sc_Pair.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) { - var current = this; - - var res = "("; - - while(true) { - res += writeOrDisplay(current.car); - if (sc_isPair(current.cdr)) { - res += " "; - current = current.cdr; - } else if (current.cdr !== null) { - res += " . " + writeOrDisplay(current.cdr); - break; - } else // current.cdr == null - break; - } - - res += ")"; +sc_Pair.prototype.sc_toWriteOrDisplayString = function (writeOrDisplay) { + var current = this; + + var res = "("; + + while (true) { + res += writeOrDisplay(current.car); + if (sc_isPair(current.cdr)) { + res += " "; + current = current.cdr; + } else if (current.cdr !== null) { + res += " . " + writeOrDisplay(current.cdr); + break; + } // current.cdr == null + else break; + } - return res; + res += ")"; + + return res; }; -sc_Pair.prototype.sc_toDisplayString = function() { - return this.sc_toWriteOrDisplayString(sc_toDisplayString); +sc_Pair.prototype.sc_toDisplayString = function () { + return this.sc_toWriteOrDisplayString(sc_toDisplayString); }; -sc_Pair.prototype.sc_toWriteString = function() { - return this.sc_toWriteOrDisplayString(sc_toWriteString); +sc_Pair.prototype.sc_toWriteString = function () { + return this.sc_toWriteOrDisplayString(sc_toWriteString); }; // sc_Pair.prototype.sc_toWriteCircleString in IO.js @@ -575,179 +570,235 @@ sc_Pair.prototype.sc_toWriteString = function() { (peephole (postfix " instanceof sc_Pair"))) */ function sc_isPair(p) { - return (p instanceof sc_Pair); + return p instanceof sc_Pair; } function sc_isPairEqual(p1, p2, comp) { - return (comp(p1.car, p2.car) && comp(p1.cdr, p2.cdr)); + return comp(p1.car, p2.car) && comp(p1.cdr, p2.cdr); } /*** META ((export #t) (peephole (hole 2 "new sc_Pair(" car ", " cdr ")"))) */ function sc_cons(car, cdr) { - return new sc_Pair(car, cdr); + return new sc_Pair(car, cdr); } /*** META ((export cons*)) */ function sc_consStar() { - var res = arguments[arguments.length - 1]; - for (var i = arguments.length-2; i >= 0; i--) - res = new sc_Pair(arguments[i], res); - return res; + var res = arguments[arguments.length - 1]; + for (var i = arguments.length - 2; i >= 0; i--) + res = new sc_Pair(arguments[i], res); + return res; } /*** META ((export #t) (peephole (postfix ".car"))) */ function sc_car(p) { - return p.car; + return p.car; } /*** META ((export #t) (peephole (postfix ".cdr"))) */ function sc_cdr(p) { - return p.cdr; + return p.cdr; } /*** META ((export #t) (peephole (hole 2 p ".car = " val))) */ function sc_setCarBang(p, val) { - p.car = val; + p.car = val; } /*** META ((export #t) (peephole (hole 2 p ".cdr = " val))) */ function sc_setCdrBang(p, val) { - p.cdr = val; + p.cdr = val; } /*** META ((export #t) (peephole (postfix ".car.car"))) */ -function sc_caar(p) { return p.car.car; } +function sc_caar(p) { + return p.car.car; +} /*** META ((export #t) (peephole (postfix ".cdr.car"))) */ -function sc_cadr(p) { return p.cdr.car; } +function sc_cadr(p) { + return p.cdr.car; +} /*** META ((export #t) (peephole (postfix ".car.cdr"))) */ -function sc_cdar(p) { return p.car.cdr; } +function sc_cdar(p) { + return p.car.cdr; +} /*** META ((export #t) (peephole (postfix ".cdr.cdr"))) */ -function sc_cddr(p) { return p.cdr.cdr; } +function sc_cddr(p) { + return p.cdr.cdr; +} /*** META ((export #t) (peephole (postfix ".car.car.car"))) */ -function sc_caaar(p) { return p.car.car.car; } +function sc_caaar(p) { + return p.car.car.car; +} /*** META ((export #t) (peephole (postfix ".car.cdr.car"))) */ -function sc_cadar(p) { return p.car.cdr.car; } +function sc_cadar(p) { + return p.car.cdr.car; +} /*** META ((export #t) (peephole (postfix ".cdr.car.car"))) */ -function sc_caadr(p) { return p.cdr.car.car; } +function sc_caadr(p) { + return p.cdr.car.car; +} /*** META ((export #t) (peephole (postfix ".cdr.cdr.car"))) */ -function sc_caddr(p) { return p.cdr.cdr.car; } +function sc_caddr(p) { + return p.cdr.cdr.car; +} /*** META ((export #t) (peephole (postfix ".car.car.cdr"))) */ -function sc_cdaar(p) { return p.car.car.cdr; } +function sc_cdaar(p) { + return p.car.car.cdr; +} /*** META ((export #t) (peephole (postfix ".cdr.car.cdr"))) */ -function sc_cdadr(p) { return p.cdr.car.cdr; } +function sc_cdadr(p) { + return p.cdr.car.cdr; +} /*** META ((export #t) (peephole (postfix ".car.cdr.cdr"))) */ -function sc_cddar(p) { return p.car.cdr.cdr; } +function sc_cddar(p) { + return p.car.cdr.cdr; +} /*** META ((export #t) (peephole (postfix ".cdr.cdr.cdr"))) */ -function sc_cdddr(p) { return p.cdr.cdr.cdr; } +function sc_cdddr(p) { + return p.cdr.cdr.cdr; +} /*** META ((export #t) (peephole (postfix ".car.car.car.car"))) */ -function sc_caaaar(p) { return p.car.car.car.car; } +function sc_caaaar(p) { + return p.car.car.car.car; +} /*** META ((export #t) (peephole (postfix ".car.cdr.car.car"))) */ -function sc_caadar(p) { return p.car.cdr.car.car; } +function sc_caadar(p) { + return p.car.cdr.car.car; +} /*** META ((export #t) (peephole (postfix ".cdr.car.car.car"))) */ -function sc_caaadr(p) { return p.cdr.car.car.car; } +function sc_caaadr(p) { + return p.cdr.car.car.car; +} /*** META ((export #t) (peephole (postfix ".cdr.cdr.car.car"))) */ -function sc_caaddr(p) { return p.cdr.cdr.car.car; } +function sc_caaddr(p) { + return p.cdr.cdr.car.car; +} /*** META ((export #t) (peephole (postfix ".car.car.car.cdr"))) */ -function sc_cdaaar(p) { return p.car.car.car.cdr; } +function sc_cdaaar(p) { + return p.car.car.car.cdr; +} /*** META ((export #t) (peephole (postfix ".car.cdr.car.cdr"))) */ -function sc_cdadar(p) { return p.car.cdr.car.cdr; } +function sc_cdadar(p) { + return p.car.cdr.car.cdr; +} /*** META ((export #t) (peephole (postfix ".cdr.car.car.cdr"))) */ -function sc_cdaadr(p) { return p.cdr.car.car.cdr; } +function sc_cdaadr(p) { + return p.cdr.car.car.cdr; +} /*** META ((export #t) (peephole (postfix ".cdr.cdr.car.cdr"))) */ -function sc_cdaddr(p) { return p.cdr.cdr.car.cdr; } +function sc_cdaddr(p) { + return p.cdr.cdr.car.cdr; +} /*** META ((export #t) (peephole (postfix ".car.car.cdr.car"))) */ -function sc_cadaar(p) { return p.car.car.cdr.car; } +function sc_cadaar(p) { + return p.car.car.cdr.car; +} /*** META ((export #t) (peephole (postfix ".car.cdr.cdr.car"))) */ -function sc_caddar(p) { return p.car.cdr.cdr.car; } +function sc_caddar(p) { + return p.car.cdr.cdr.car; +} /*** META ((export #t) (peephole (postfix ".cdr.car.cdr.car"))) */ -function sc_cadadr(p) { return p.cdr.car.cdr.car; } +function sc_cadadr(p) { + return p.cdr.car.cdr.car; +} /*** META ((export #t) (peephole (postfix ".cdr.cdr.cdr.car"))) */ -function sc_cadddr(p) { return p.cdr.cdr.cdr.car; } +function sc_cadddr(p) { + return p.cdr.cdr.cdr.car; +} /*** META ((export #t) (peephole (postfix ".car.car.cdr.cdr"))) */ -function sc_cddaar(p) { return p.car.car.cdr.cdr; } +function sc_cddaar(p) { + return p.car.car.cdr.cdr; +} /*** META ((export #t) (peephole (postfix ".car.cdr.cdr.cdr"))) */ -function sc_cdddar(p) { return p.car.cdr.cdr.cdr; } +function sc_cdddar(p) { + return p.car.cdr.cdr.cdr; +} /*** META ((export #t) (peephole (postfix ".cdr.car.cdr.cdr"))) */ -function sc_cddadr(p) { return p.cdr.car.cdr.cdr; } +function sc_cddadr(p) { + return p.cdr.car.cdr.cdr; +} /*** META ((export #t) (peephole (postfix ".cdr.cdr.cdr.cdr"))) */ -function sc_cddddr(p) { return p.cdr.cdr.cdr.cdr; } +function sc_cddddr(p) { + return p.cdr.cdr.cdr.cdr; +} /*** META ((export #t)) */ function sc_lastPair(l) { - if (!sc_isPair(l)) sc_error("sc_lastPair: pair expected"); - var res = l; - var cdr = l.cdr; - while (sc_isPair(cdr)) { - res = cdr; - cdr = res.cdr; - } - return res; + if (!sc_isPair(l)) sc_error("sc_lastPair: pair expected"); + var res = l; + var cdr = l.cdr; + while (sc_isPair(cdr)) { + res = cdr; + cdr = res.cdr; + } + return res; } /*** META ((export #t) @@ -755,210 +806,203 @@ function sc_lastPair(l) { (peephole (postfix " === null"))) */ function sc_isNull(o) { - return (o === null); + return o === null; } /*** META ((export #t) (type bool)) */ function sc_isList(o) { - var rabbit; - var turtle; - - var rabbit = o; - var turtle = o; - while (true) { - if (rabbit === null || - (rabbit instanceof sc_Pair && rabbit.cdr === null)) - return true; // end of list - else if ((rabbit instanceof sc_Pair) && - (rabbit.cdr instanceof sc_Pair)) { - rabbit = rabbit.cdr.cdr; - turtle = turtle.cdr; - if (rabbit === turtle) return false; // cycle - } else - return false; // not pair - } + var rabbit; + var turtle; + + var rabbit = o; + var turtle = o; + while (true) { + if (rabbit === null || (rabbit instanceof sc_Pair && rabbit.cdr === null)) + return true; // end of list + else if (rabbit instanceof sc_Pair && rabbit.cdr instanceof sc_Pair) { + rabbit = rabbit.cdr.cdr; + turtle = turtle.cdr; + if (rabbit === turtle) return false; // cycle + } else return false; // not pair + } } /*** META ((export #t)) */ function sc_list() { - var res = null; - var a = arguments; - for (var i = a.length-1; i >= 0; i--) - res = new sc_Pair(a[i], res); - return res; + var res = null; + var a = arguments; + for (var i = a.length - 1; i >= 0; i--) res = new sc_Pair(a[i], res); + return res; } /*** META ((export #t)) */ function sc_iota(num, init) { - var res = null; - if (!init) init = 0; - for (var i = num - 1; i >= 0; i--) - res = new sc_Pair(i + init, res); - return res; + var res = null; + if (!init) init = 0; + for (var i = num - 1; i >= 0; i--) res = new sc_Pair(i + init, res); + return res; } /*** META ((export #t)) */ function sc_makeList(nbEls, fill) { - var res = null; - for (var i = 0; i < nbEls; i++) - res = new sc_Pair(fill, res); - return res; + var res = null; + for (var i = 0; i < nbEls; i++) res = new sc_Pair(fill, res); + return res; } /*** META ((export #t)) */ function sc_length(l) { - var res = 0; - while (l !== null) { - res++; - l = l.cdr; - } - return res; + var res = 0; + while (l !== null) { + res++; + l = l.cdr; + } + return res; } /*** META ((export #t)) */ function sc_remq(o, l) { - var dummy = { cdr : null }; - var tail = dummy; - while (l !== null) { - if (l.car !== o) { - tail.cdr = sc_cons(l.car, null); - tail = tail.cdr; - } - l = l.cdr; + var dummy = { cdr: null }; + var tail = dummy; + while (l !== null) { + if (l.car !== o) { + tail.cdr = sc_cons(l.car, null); + tail = tail.cdr; } - return dummy.cdr; + l = l.cdr; + } + return dummy.cdr; } /*** META ((export #t)) */ function sc_remqBang(o, l) { - var dummy = { cdr : null }; - var tail = dummy; - var needsAssig = true; - while (l !== null) { - if (l.car === o) { - needsAssig = true; - } else { - if (needsAssig) { - tail.cdr = l; - needsAssig = false; - } - tail = l; - } - l = l.cdr; + var dummy = { cdr: null }; + var tail = dummy; + var needsAssig = true; + while (l !== null) { + if (l.car === o) { + needsAssig = true; + } else { + if (needsAssig) { + tail.cdr = l; + needsAssig = false; + } + tail = l; } - tail.cdr = null; - return dummy.cdr; + l = l.cdr; + } + tail.cdr = null; + return dummy.cdr; } /*** META ((export #t)) */ function sc_delete(o, l) { - var dummy = { cdr : null }; - var tail = dummy; - while (l !== null) { - if (!sc_isEqual(l.car, o)) { - tail.cdr = sc_cons(l.car, null); - tail = tail.cdr; - } - l = l.cdr; + var dummy = { cdr: null }; + var tail = dummy; + while (l !== null) { + if (!sc_isEqual(l.car, o)) { + tail.cdr = sc_cons(l.car, null); + tail = tail.cdr; } - return dummy.cdr; + l = l.cdr; + } + return dummy.cdr; } /*** META ((export #t)) */ function sc_deleteBang(o, l) { - var dummy = { cdr : null }; - var tail = dummy; - var needsAssig = true; - while (l !== null) { - if (sc_isEqual(l.car, o)) { - needsAssig = true; - } else { - if (needsAssig) { - tail.cdr = l; - needsAssig = false; - } - tail = l; - } - l = l.cdr; + var dummy = { cdr: null }; + var tail = dummy; + var needsAssig = true; + while (l !== null) { + if (sc_isEqual(l.car, o)) { + needsAssig = true; + } else { + if (needsAssig) { + tail.cdr = l; + needsAssig = false; + } + tail = l; } - tail.cdr = null; - return dummy.cdr; + l = l.cdr; + } + tail.cdr = null; + return dummy.cdr; } function sc_reverseAppendBang(l1, l2) { - var res = l2; - while (l1 !== null) { - var tmp = res; - res = l1; - l1 = l1.cdr; - res.cdr = tmp; - } - return res; + var res = l2; + while (l1 !== null) { + var tmp = res; + res = l1; + l1 = l1.cdr; + res.cdr = tmp; + } + return res; } - + function sc_dualAppend(l1, l2) { - if (l1 === null) return l2; - if (l2 === null) return l1; - var rev = sc_reverse(l1); - return sc_reverseAppendBang(rev, l2); + if (l1 === null) return l2; + if (l2 === null) return l1; + var rev = sc_reverse(l1); + return sc_reverseAppendBang(rev, l2); } /*** META ((export #t)) */ function sc_append() { - if (arguments.length === 0) - return null; - var res = arguments[arguments.length - 1]; - for (var i = arguments.length - 2; i >= 0; i--) - res = sc_dualAppend(arguments[i], res); - return res; + if (arguments.length === 0) return null; + var res = arguments[arguments.length - 1]; + for (var i = arguments.length - 2; i >= 0; i--) + res = sc_dualAppend(arguments[i], res); + return res; } function sc_dualAppendBang(l1, l2) { - if (l1 === null) return l2; - if (l2 === null) return l1; - var tmp = l1; - while (tmp.cdr !== null) tmp=tmp.cdr; - tmp.cdr = l2; - return l1; + if (l1 === null) return l2; + if (l2 === null) return l1; + var tmp = l1; + while (tmp.cdr !== null) tmp = tmp.cdr; + tmp.cdr = l2; + return l1; } /*** META ((export #t)) */ function sc_appendBang() { - var res = null; - for (var i = 0; i < arguments.length; i++) - res = sc_dualAppendBang(res, arguments[i]); - return res; + var res = null; + for (var i = 0; i < arguments.length; i++) + res = sc_dualAppendBang(res, arguments[i]); + return res; } /*** META ((export #t)) */ function sc_reverse(l1) { - var res = null; - while (l1 !== null) { - res = sc_cons(l1.car, res); - l1 = l1.cdr; - } - return res; + var res = null; + while (l1 !== null) { + res = sc_cons(l1.car, res); + l1 = l1.cdr; + } + return res; } /*** META ((export #t)) */ function sc_reverseBang(l) { - return sc_reverseAppendBang(l, null); + return sc_reverseAppendBang(l, null); } /*** META ((export #t)) */ function sc_listTail(l, k) { - var res = l; - for (var i = 0; i < k; i++) { - res = res.cdr; - } - return res; + var res = l; + for (var i = 0; i < k; i++) { + res = res.cdr; + } + return res; } /*** META ((export #t)) */ function sc_listRef(l, k) { - return sc_listTail(l, k).car; + return sc_listTail(l, k).car; } /* // unoptimized generic versions @@ -978,30 +1022,27 @@ function sc_member(o, l) { return sc_memX(o, l, sc_isEqual); } /* optimized versions */ /*** META ((export #t)) */ function sc_memq(o, l) { - while (l !== null) { - if (l.car === o) - return l; - l = l.cdr; - } - return false; + while (l !== null) { + if (l.car === o) return l; + l = l.cdr; + } + return false; } /*** META ((export #t)) */ function sc_memv(o, l) { - while (l !== null) { - if (l.car === o) - return l; - l = l.cdr; - } - return false; + while (l !== null) { + if (l.car === o) return l; + l = l.cdr; + } + return false; } /*** META ((export #t)) */ function sc_member(o, l) { - while (l !== null) { - if (sc_isEqual(l.car,o)) - return l; - l = l.cdr; - } - return false; + while (l !== null) { + if (sc_isEqual(l.car, o)) return l; + l = l.cdr; + } + return false; } /* // generic unoptimized versions @@ -1020,160 +1061,168 @@ function sc_assoc(o, al) { return sc_assX(o, al, sc_isEqual); } // optimized versions /*** META ((export #t)) */ function sc_assq(o, al) { - while (al !== null) { - if (al.car.car === o) - return al.car; - al = al.cdr; - } - return false; + while (al !== null) { + if (al.car.car === o) return al.car; + al = al.cdr; + } + return false; } /*** META ((export #t)) */ function sc_assv(o, al) { - while (al !== null) { - if (al.car.car === o) - return al.car; - al = al.cdr; - } - return false; + while (al !== null) { + if (al.car.car === o) return al.car; + al = al.cdr; + } + return false; } /*** META ((export #t)) */ function sc_assoc(o, al) { - while (al !== null) { - if (sc_isEqual(al.car.car, o)) - return al.car; - al = al.cdr; - } - return false; + while (al !== null) { + if (sc_isEqual(al.car.car, o)) return al.car; + al = al.cdr; + } + return false; } /* can be used for mutable strings and characters */ -function sc_isCharStringEqual(cs1, cs2) { return cs1.val === cs2.val; } -function sc_isCharStringLess(cs1, cs2) { return cs1.val < cs2.val; } -function sc_isCharStringGreater(cs1, cs2) { return cs1.val > cs2.val; } -function sc_isCharStringLessEqual(cs1, cs2) { return cs1.val <= cs2.val; } -function sc_isCharStringGreaterEqual(cs1, cs2) { return cs1.val >= cs2.val; } -function sc_isCharStringCIEqual(cs1, cs2) - { return cs1.val.toLowerCase() === cs2.val.toLowerCase(); } -function sc_isCharStringCILess(cs1, cs2) - { return cs1.val.toLowerCase() < cs2.val.toLowerCase(); } -function sc_isCharStringCIGreater(cs1, cs2) - { return cs1.val.toLowerCase() > cs2.val.toLowerCase(); } -function sc_isCharStringCILessEqual(cs1, cs2) - { return cs1.val.toLowerCase() <= cs2.val.toLowerCase(); } -function sc_isCharStringCIGreaterEqual(cs1, cs2) - { return cs1.val.toLowerCase() >= cs2.val.toLowerCase(); } - - - +function sc_isCharStringEqual(cs1, cs2) { + return cs1.val === cs2.val; +} +function sc_isCharStringLess(cs1, cs2) { + return cs1.val < cs2.val; +} +function sc_isCharStringGreater(cs1, cs2) { + return cs1.val > cs2.val; +} +function sc_isCharStringLessEqual(cs1, cs2) { + return cs1.val <= cs2.val; +} +function sc_isCharStringGreaterEqual(cs1, cs2) { + return cs1.val >= cs2.val; +} +function sc_isCharStringCIEqual(cs1, cs2) { + return cs1.val.toLowerCase() === cs2.val.toLowerCase(); +} +function sc_isCharStringCILess(cs1, cs2) { + return cs1.val.toLowerCase() < cs2.val.toLowerCase(); +} +function sc_isCharStringCIGreater(cs1, cs2) { + return cs1.val.toLowerCase() > cs2.val.toLowerCase(); +} +function sc_isCharStringCILessEqual(cs1, cs2) { + return cs1.val.toLowerCase() <= cs2.val.toLowerCase(); +} +function sc_isCharStringCIGreaterEqual(cs1, cs2) { + return cs1.val.toLowerCase() >= cs2.val.toLowerCase(); +} function sc_Char(c) { - var cached = sc_Char.lazy[c]; - if (cached) - return cached; - this.val = c; - sc_Char.lazy[c] = this; - // add return, so FF does not complain. - return undefined; + var cached = sc_Char.lazy[c]; + if (cached) return cached; + this.val = c; + sc_Char.lazy[c] = this; + // add return, so FF does not complain. + return undefined; } sc_Char.lazy = new Object(); // thanks to Eric sc_Char.char2readable = { - "\000": "#\\null", - "\007": "#\\bell", - "\010": "#\\backspace", - "\011": "#\\tab", - "\012": "#\\newline", - "\014": "#\\page", - "\015": "#\\return", - "\033": "#\\escape", - "\040": "#\\space", - "\177": "#\\delete", + "\000": "#\\null", + "\007": "#\\bell", + "\010": "#\\backspace", + "\011": "#\\tab", + "\012": "#\\newline", + "\014": "#\\page", + "\015": "#\\return", + "\033": "#\\escape", + "\040": "#\\space", + "\177": "#\\delete", /* poeticless names */ - "\001": "#\\soh", - "\002": "#\\stx", - "\003": "#\\etx", - "\004": "#\\eot", - "\005": "#\\enq", - "\006": "#\\ack", - - "\013": "#\\vt", - "\016": "#\\so", - "\017": "#\\si", - - "\020": "#\\dle", - "\021": "#\\dc1", - "\022": "#\\dc2", - "\023": "#\\dc3", - "\024": "#\\dc4", - "\025": "#\\nak", - "\026": "#\\syn", - "\027": "#\\etb", - - "\030": "#\\can", - "\031": "#\\em", - "\032": "#\\sub", - "\033": "#\\esc", - "\034": "#\\fs", - "\035": "#\\gs", - "\036": "#\\rs", - "\037": "#\\us"}; + "\001": "#\\soh", + "\002": "#\\stx", + "\003": "#\\etx", + "\004": "#\\eot", + "\005": "#\\enq", + "\006": "#\\ack", + + "\013": "#\\vt", + "\016": "#\\so", + "\017": "#\\si", + + "\020": "#\\dle", + "\021": "#\\dc1", + "\022": "#\\dc2", + "\023": "#\\dc3", + "\024": "#\\dc4", + "\025": "#\\nak", + "\026": "#\\syn", + "\027": "#\\etb", + + "\030": "#\\can", + "\031": "#\\em", + "\032": "#\\sub", + "\033": "#\\esc", + "\034": "#\\fs", + "\035": "#\\gs", + "\036": "#\\rs", + "\037": "#\\us", +}; sc_Char.readable2char = { - "null": "\000", - "bell": "\007", - "backspace": "\010", - "tab": "\011", - "newline": "\012", - "page": "\014", - "return": "\015", - "escape": "\033", - "space": "\040", - "delete": "\000", - "soh": "\001", - "stx": "\002", - "etx": "\003", - "eot": "\004", - "enq": "\005", - "ack": "\006", - "bel": "\007", - "bs": "\010", - "ht": "\011", - "nl": "\012", - "vt": "\013", - "np": "\014", - "cr": "\015", - "so": "\016", - "si": "\017", - "dle": "\020", - "dc1": "\021", - "dc2": "\022", - "dc3": "\023", - "dc4": "\024", - "nak": "\025", - "syn": "\026", - "etb": "\027", - "can": "\030", - "em": "\031", - "sub": "\032", - "esc": "\033", - "fs": "\034", - "gs": "\035", - "rs": "\036", - "us": "\037", - "sp": "\040", - "del": "\177"}; - -sc_Char.prototype.toString = function() { - return this.val; + null: "\000", + bell: "\007", + backspace: "\010", + tab: "\011", + newline: "\012", + page: "\014", + return: "\015", + escape: "\033", + space: "\040", + delete: "\000", + soh: "\001", + stx: "\002", + etx: "\003", + eot: "\004", + enq: "\005", + ack: "\006", + bel: "\007", + bs: "\010", + ht: "\011", + nl: "\012", + vt: "\013", + np: "\014", + cr: "\015", + so: "\016", + si: "\017", + dle: "\020", + dc1: "\021", + dc2: "\022", + dc3: "\023", + dc4: "\024", + nak: "\025", + syn: "\026", + etb: "\027", + can: "\030", + em: "\031", + sub: "\032", + esc: "\033", + fs: "\034", + gs: "\035", + rs: "\036", + us: "\037", + sp: "\040", + del: "\177", +}; + +sc_Char.prototype.toString = function () { + return this.val; }; // sc_toDisplayString == toString -sc_Char.prototype.sc_toWriteString = function() { - var entry = sc_Char.char2readable[this.val]; - if (entry) - return entry; - else - return "#\\" + this.val; +sc_Char.prototype.sc_toWriteString = function () { + var entry = sc_Char.char2readable[this.val]; + if (entry) return entry; + else return "#\\" + this.val; }; /*** META ((export #t) @@ -1181,7 +1230,7 @@ sc_Char.prototype.sc_toWriteString = function() { (peephole (postfix "instanceof sc_Char"))) */ function sc_isChar(c) { - return (c instanceof sc_Char); + return c instanceof sc_Char; } /*** META ((export char=?) @@ -1236,124 +1285,132 @@ var sc_isCharCILessEqual = sc_isCharStringCILessEqual; var sc_isCharCIGreaterEqual = sc_isCharStringCIGreaterEqual; var SC_NUMBER_CLASS = "0123456789"; -var SC_WHITESPACE_CLASS = ' \r\n\t\f'; -var SC_LOWER_CLASS = 'abcdefghijklmnopqrstuvwxyz'; -var SC_UPPER_CLASS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; +var SC_WHITESPACE_CLASS = " \r\n\t\f"; +var SC_LOWER_CLASS = "abcdefghijklmnopqrstuvwxyz"; +var SC_UPPER_CLASS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -function sc_isCharOfClass(c, cl) { return (cl.indexOf(c) != -1); } +function sc_isCharOfClass(c, cl) { + return cl.indexOf(c) != -1; +} /*** META ((export #t) (type bool)) */ -function sc_isCharAlphabetic(c) - { return sc_isCharOfClass(c.val, SC_LOWER_CLASS) || - sc_isCharOfClass(c.val, SC_UPPER_CLASS); } +function sc_isCharAlphabetic(c) { + return ( + sc_isCharOfClass(c.val, SC_LOWER_CLASS) || + sc_isCharOfClass(c.val, SC_UPPER_CLASS) + ); +} /*** META ((export #t) (type bool) (peephole (hole 1 "SC_NUMBER_CLASS.indexOf(" c ".val) != -1"))) */ -function sc_isCharNumeric(c) - { return sc_isCharOfClass(c.val, SC_NUMBER_CLASS); } +function sc_isCharNumeric(c) { + return sc_isCharOfClass(c.val, SC_NUMBER_CLASS); +} /*** META ((export #t) (type bool)) */ function sc_isCharWhitespace(c) { - var tmp = c.val; - return tmp === " " || tmp === "\r" || tmp === "\n" || tmp === "\t" || tmp === "\f"; + var tmp = c.val; + return ( + tmp === " " || tmp === "\r" || tmp === "\n" || tmp === "\t" || tmp === "\f" + ); } /*** META ((export #t) (type bool) (peephole (hole 1 "SC_UPPER_CLASS.indexOf(" c ".val) != -1"))) */ -function sc_isCharUpperCase(c) - { return sc_isCharOfClass(c.val, SC_UPPER_CLASS); } +function sc_isCharUpperCase(c) { + return sc_isCharOfClass(c.val, SC_UPPER_CLASS); +} /*** META ((export #t) (type bool) (peephole (hole 1 "SC_LOWER_CLASS.indexOf(" c ".val) != -1"))) */ -function sc_isCharLowerCase(c) - { return sc_isCharOfClass(c.val, SC_LOWER_CLASS); } +function sc_isCharLowerCase(c) { + return sc_isCharOfClass(c.val, SC_LOWER_CLASS); +} /*** META ((export #t) (peephole (postfix ".val.charCodeAt(0)"))) */ -function sc_char2integer(c) - { return c.val.charCodeAt(0); } +function sc_char2integer(c) { + return c.val.charCodeAt(0); +} /*** META ((export #t) (peephole (hole 1 "new sc_Char(String.fromCharCode(" n "))"))) */ -function sc_integer2char(n) - { return new sc_Char(String.fromCharCode(n)); } +function sc_integer2char(n) { + return new sc_Char(String.fromCharCode(n)); +} /*** META ((export #t) (peephole (hole 1 "new sc_Char(" c ".val.toUpperCase())"))) */ -function sc_charUpcase(c) - { return new sc_Char(c.val.toUpperCase()); } +function sc_charUpcase(c) { + return new sc_Char(c.val.toUpperCase()); +} /*** META ((export #t) (peephole (hole 1 "new sc_Char(" c ".val.toLowerCase())"))) */ -function sc_charDowncase(c) - { return new sc_Char(c.val.toLowerCase()); } +function sc_charDowncase(c) { + return new sc_Char(c.val.toLowerCase()); +} function sc_makeJSStringOfLength(k, c) { - var fill; - if (c === undefined) - fill = " "; - else - fill = c; - var res = ""; - var len = 1; - // every round doubles the size of fill. - while (k >= len) { - if (k & len) - res = res.concat(fill); - fill = fill.concat(fill); - len *= 2; - } - return res; + var fill; + if (c === undefined) fill = " "; + else fill = c; + var res = ""; + var len = 1; + // every round doubles the size of fill. + while (k >= len) { + if (k & len) res = res.concat(fill); + fill = fill.concat(fill); + len *= 2; + } + return res; } function sc_makejsString(k, c) { - var fill; - if (c) - fill = c.val; - else - fill = " "; - return sc_makeJSStringOfLength(k, fill); + var fill; + if (c) fill = c.val; + else fill = " "; + return sc_makeJSStringOfLength(k, fill); } function sc_jsstring2list(s) { - var res = null; - for (var i = s.length - 1; i >= 0; i--) - res = sc_cons(new sc_Char(s.charAt(i)), res); - return res; + var res = null; + for (var i = s.length - 1; i >= 0; i--) + res = sc_cons(new sc_Char(s.charAt(i)), res); + return res; } function sc_list2jsstring(l) { - var a = new Array(); - while(l !== null) { - a.push(l.car.val); - l = l.cdr; - } - return "".concat.apply("", a); + var a = new Array(); + while (l !== null) { + a.push(l.car.val); + l = l.cdr; + } + return "".concat.apply("", a); } var sc_Vector = Array; -sc_Vector.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) { - if (this.length === 0) return "#()"; +sc_Vector.prototype.sc_toWriteOrDisplayString = function (writeOrDisplay) { + if (this.length === 0) return "#()"; - var res = "#(" + writeOrDisplay(this[0]); - for (var i = 1; i < this.length; i++) - res += " " + writeOrDisplay(this[i]); - res += ")"; - return res; + var res = "#(" + writeOrDisplay(this[0]); + for (var i = 1; i < this.length; i++) res += " " + writeOrDisplay(this[i]); + res += ")"; + return res; }; -sc_Vector.prototype.sc_toDisplayString = function() { - return this.sc_toWriteOrDisplayString(sc_toDisplayString); +sc_Vector.prototype.sc_toDisplayString = function () { + return this.sc_toWriteOrDisplayString(sc_toDisplayString); }; -sc_Vector.prototype.sc_toWriteString = function() { - return this.sc_toWriteOrDisplayString(sc_toWriteString); +sc_Vector.prototype.sc_toWriteString = function () { + return this.sc_toWriteOrDisplayString(sc_toWriteString); }; /*** META ((export vector? array?) @@ -1361,118 +1418,109 @@ sc_Vector.prototype.sc_toWriteString = function() { (peephole (postfix " instanceof sc_Vector"))) */ function sc_isVector(v) { - return (v instanceof sc_Vector); + return v instanceof sc_Vector; } // only applies to vectors function sc_isVectorEqual(v1, v2, comp) { - if (v1.length !== v2.length) return false; - for (var i = 0; i < v1.length; i++) - if (!comp(v1[i], v2[i])) return false; - return true; + if (v1.length !== v2.length) return false; + for (var i = 0; i < v1.length; i++) if (!comp(v1[i], v2[i])) return false; + return true; } /*** META ((export make-vector make-array)) */ function sc_makeVector(size, fill) { - var a = new sc_Vector(size); - if (fill !== undefined) - sc_vectorFillBang(a, fill); - return a; + var a = new sc_Vector(size); + if (fill !== undefined) sc_vectorFillBang(a, fill); + return a; } /*** META ((export vector array) (peephole (vector))) */ function sc_vector() { - var a = new sc_Vector(); - for (var i = 0; i < arguments.length; i++) - a.push(arguments[i]); - return a; + var a = new sc_Vector(); + for (var i = 0; i < arguments.length; i++) a.push(arguments[i]); + return a; } /*** META ((export vector-length array-length) (peephole (postfix ".length"))) */ function sc_vectorLength(v) { - return v.length; + return v.length; } /*** META ((export vector-ref array-ref) (peephole (hole 2 v "[" pos "]"))) */ function sc_vectorRef(v, pos) { - return v[pos]; + return v[pos]; } /*** META ((export vector-set! array-set!) (peephole (hole 3 v "[" pos "] = " val))) */ function sc_vectorSetBang(v, pos, val) { - v[pos] = val; + v[pos] = val; } /*** META ((export vector->list array->list)) */ function sc_vector2list(a) { - var res = null; - for (var i = a.length-1; i >= 0; i--) - res = sc_cons(a[i], res); - return res; + var res = null; + for (var i = a.length - 1; i >= 0; i--) res = sc_cons(a[i], res); + return res; } /*** META ((export list->vector list->array)) */ function sc_list2vector(l) { - var a = new sc_Vector(); - while(l !== null) { - a.push(l.car); - l = l.cdr; - } - return a; + var a = new sc_Vector(); + while (l !== null) { + a.push(l.car); + l = l.cdr; + } + return a; } /*** META ((export vector-fill! array-fill!)) */ function sc_vectorFillBang(a, fill) { - for (var i = 0; i < a.length; i++) - a[i] = fill; + for (var i = 0; i < a.length; i++) a[i] = fill; } - /*** META ((export #t)) */ function sc_copyVector(a, len) { - if (len <= a.length) - return a.slice(0, len); - else { - var tmp = a.concat(); - tmp.length = len; - return tmp; - } + if (len <= a.length) return a.slice(0, len); + else { + var tmp = a.concat(); + tmp.length = len; + return tmp; + } } /*** META ((export #t) (peephole (hole 3 a ".slice(" start "," end ")"))) */ function sc_vectorCopy(a, start, end) { - return a.slice(start, end); + return a.slice(start, end); } /*** META ((export #t)) */ function sc_vectorCopyBang(target, tstart, source, sstart, send) { - if (!sstart) sstart = 0; - if (!send) send = source.length; - - // if target == source we don't want to overwrite not yet copied elements. - if (tstart <= sstart) { - for (var i = tstart, j = sstart; j < send; i++, j++) { - target[i] = source[j]; - } - } else { - var diff = send - sstart; - for (var i = tstart + diff - 1, j = send - 1; - j >= sstart; - i--, j--) { - target[i] = source[j]; - } + if (!sstart) sstart = 0; + if (!send) send = source.length; + + // if target == source we don't want to overwrite not yet copied elements. + if (tstart <= sstart) { + for (var i = tstart, j = sstart; j < send; i++, j++) { + target[i] = source[j]; } - return target; + } else { + var diff = send - sstart; + for (var i = tstart + diff - 1, j = send - 1; j >= sstart; i--, j--) { + target[i] = source[j]; + } + } + return target; } /*** META ((export #t) @@ -1480,257 +1528,246 @@ function sc_vectorCopyBang(target, tstart, source, sstart, send) { (peephole (hole 1 "typeof " o " === 'function'"))) */ function sc_isProcedure(o) { - return (typeof o === "function"); + return typeof o === "function"; } /*** META ((export #t)) */ function sc_apply(proc) { - var args = new Array(); - // first part of arguments are not in list-form. - for (var i = 1; i < arguments.length - 1; i++) - args.push(arguments[i]); - var l = arguments[arguments.length - 1]; - while (l !== null) { - args.push(l.car); - l = l.cdr; - } - return proc.apply(null, args); + var args = new Array(); + // first part of arguments are not in list-form. + for (var i = 1; i < arguments.length - 1; i++) args.push(arguments[i]); + var l = arguments[arguments.length - 1]; + while (l !== null) { + args.push(l.car); + l = l.cdr; + } + return proc.apply(null, args); } /*** META ((export #t)) */ function sc_map(proc, l1) { - if (l1 === undefined) - return null; - // else - var nbApplyArgs = arguments.length - 1; - var applyArgs = new Array(nbApplyArgs); - var revres = null; - while (l1 !== null) { - for (var i = 0; i < nbApplyArgs; i++) { - applyArgs[i] = arguments[i + 1].car; - arguments[i + 1] = arguments[i + 1].cdr; - } - revres = sc_cons(proc.apply(null, applyArgs), revres); + if (l1 === undefined) return null; + // else + var nbApplyArgs = arguments.length - 1; + var applyArgs = new Array(nbApplyArgs); + var revres = null; + while (l1 !== null) { + for (var i = 0; i < nbApplyArgs; i++) { + applyArgs[i] = arguments[i + 1].car; + arguments[i + 1] = arguments[i + 1].cdr; } - return sc_reverseAppendBang(revres, null); + revres = sc_cons(proc.apply(null, applyArgs), revres); + } + return sc_reverseAppendBang(revres, null); } /*** META ((export #t)) */ function sc_mapBang(proc, l1) { - if (l1 === undefined) - return null; - // else - var l1_orig = l1; - var nbApplyArgs = arguments.length - 1; - var applyArgs = new Array(nbApplyArgs); - while (l1 !== null) { - var tmp = l1; - for (var i = 0; i < nbApplyArgs; i++) { - applyArgs[i] = arguments[i + 1].car; - arguments[i + 1] = arguments[i + 1].cdr; - } - tmp.car = proc.apply(null, applyArgs); + if (l1 === undefined) return null; + // else + var l1_orig = l1; + var nbApplyArgs = arguments.length - 1; + var applyArgs = new Array(nbApplyArgs); + while (l1 !== null) { + var tmp = l1; + for (var i = 0; i < nbApplyArgs; i++) { + applyArgs[i] = arguments[i + 1].car; + arguments[i + 1] = arguments[i + 1].cdr; } - return l1_orig; + tmp.car = proc.apply(null, applyArgs); + } + return l1_orig; } /*** META ((export #t)) */ function sc_forEach(proc, l1) { - if (l1 === undefined) - return undefined; - // else - var nbApplyArgs = arguments.length - 1; - var applyArgs = new Array(nbApplyArgs); - while (l1 !== null) { - for (var i = 0; i < nbApplyArgs; i++) { - applyArgs[i] = arguments[i + 1].car; - arguments[i + 1] = arguments[i + 1].cdr; - } - proc.apply(null, applyArgs); + if (l1 === undefined) return undefined; + // else + var nbApplyArgs = arguments.length - 1; + var applyArgs = new Array(nbApplyArgs); + while (l1 !== null) { + for (var i = 0; i < nbApplyArgs; i++) { + applyArgs[i] = arguments[i + 1].car; + arguments[i + 1] = arguments[i + 1].cdr; } - // add return so FF does not complain. - return undefined; + proc.apply(null, applyArgs); + } + // add return so FF does not complain. + return undefined; } /*** META ((export #t)) */ function sc_filter(proc, l1) { - var dummy = { cdr : null }; - var tail = dummy; - while (l1 !== null) { - if (proc(l1.car) !== false) { - tail.cdr = sc_cons(l1.car, null); - tail = tail.cdr; - } - l1 = l1.cdr; + var dummy = { cdr: null }; + var tail = dummy; + while (l1 !== null) { + if (proc(l1.car) !== false) { + tail.cdr = sc_cons(l1.car, null); + tail = tail.cdr; } - return dummy.cdr; + l1 = l1.cdr; + } + return dummy.cdr; } /*** META ((export #t)) */ function sc_filterBang(proc, l1) { - var head = sc_cons("dummy", l1); - var it = head; - var next = l1; - while (next !== null) { - if (proc(next.car) !== false) { - it.cdr = next - it = next; - } - next = next.cdr; + var head = sc_cons("dummy", l1); + var it = head; + var next = l1; + while (next !== null) { + if (proc(next.car) !== false) { + it.cdr = next; + it = next; } - it.cdr = null; - return head.cdr; + next = next.cdr; + } + it.cdr = null; + return head.cdr; } function sc_filterMap1(proc, l1) { - var revres = null; - while (l1 !== null) { - var tmp = proc(l1.car) - if (tmp !== false) revres = sc_cons(tmp, revres); - l1 = l1.cdr; - } - return sc_reverseAppendBang(revres, null); + var revres = null; + while (l1 !== null) { + var tmp = proc(l1.car); + if (tmp !== false) revres = sc_cons(tmp, revres); + l1 = l1.cdr; + } + return sc_reverseAppendBang(revres, null); } function sc_filterMap2(proc, l1, l2) { - var revres = null; - while (l1 !== null) { - var tmp = proc(l1.car, l2.car); - if(tmp !== false) revres = sc_cons(tmp, revres); - l1 = l1.cdr; - l2 = l2.cdr - } - return sc_reverseAppendBang(revres, null); + var revres = null; + while (l1 !== null) { + var tmp = proc(l1.car, l2.car); + if (tmp !== false) revres = sc_cons(tmp, revres); + l1 = l1.cdr; + l2 = l2.cdr; + } + return sc_reverseAppendBang(revres, null); } /*** META ((export #t)) */ function sc_filterMap(proc, l1, l2, l3) { - if (l2 === undefined) - return sc_filterMap1(proc, l1); - else if (l3 === undefined) - return sc_filterMap2(proc, l1, l2); - // else - var nbApplyArgs = arguments.length - 1; - var applyArgs = new Array(nbApplyArgs); - var revres = null; - while (l1 !== null) { - for (var i = 0; i < nbApplyArgs; i++) { - applyArgs[i] = arguments[i + 1].car; - arguments[i + 1] = arguments[i + 1].cdr; - } - var tmp = proc.apply(null, applyArgs); - if(tmp !== false) revres = sc_cons(tmp, revres); + if (l2 === undefined) return sc_filterMap1(proc, l1); + else if (l3 === undefined) return sc_filterMap2(proc, l1, l2); + // else + var nbApplyArgs = arguments.length - 1; + var applyArgs = new Array(nbApplyArgs); + var revres = null; + while (l1 !== null) { + for (var i = 0; i < nbApplyArgs; i++) { + applyArgs[i] = arguments[i + 1].car; + arguments[i + 1] = arguments[i + 1].cdr; } - return sc_reverseAppendBang(revres, null); + var tmp = proc.apply(null, applyArgs); + if (tmp !== false) revres = sc_cons(tmp, revres); + } + return sc_reverseAppendBang(revres, null); } /*** META ((export #t)) */ function sc_any(proc, l) { - var revres = null; - while (l !== null) { - var tmp = proc(l.car); - if(tmp !== false) return tmp; - l = l.cdr; - } - return false; + var revres = null; + while (l !== null) { + var tmp = proc(l.car); + if (tmp !== false) return tmp; + l = l.cdr; + } + return false; } /*** META ((export any?) (peephole (hole 2 "sc_any(" proc "," l ") !== false"))) */ function sc_anyPred(proc, l) { - return sc_any(proc, l)!== false; + return sc_any(proc, l) !== false; } /*** META ((export #t)) */ function sc_every(proc, l) { - var revres = null; - var tmp = true; - while (l !== null) { - tmp = proc(l.car); - if (tmp === false) return false; - l = l.cdr; - } - return tmp; + var revres = null; + var tmp = true; + while (l !== null) { + tmp = proc(l.car); + if (tmp === false) return false; + l = l.cdr; + } + return tmp; } /*** META ((export every?) (peephole (hole 2 "sc_every(" proc "," l ") !== false"))) */ function sc_everyPred(proc, l) { - var tmp = sc_every(proc, l); - if (tmp !== false) return true; - return false; + var tmp = sc_every(proc, l); + if (tmp !== false) return true; + return false; } /*** META ((export #t) (peephole (postfix "()"))) */ function sc_force(o) { - return o(); + return o(); } /*** META ((export #t)) */ function sc_makePromise(proc) { - var isResultReady = false; - var result = undefined; - return function() { - if (!isResultReady) { - var tmp = proc(); - if (!isResultReady) { - isResultReady = true; - result = tmp; - } - } - return result; - }; + var isResultReady = false; + var result = undefined; + return function () { + if (!isResultReady) { + var tmp = proc(); + if (!isResultReady) { + isResultReady = true; + result = tmp; + } + } + return result; + }; } function sc_Values(values) { - this.values = values; + this.values = values; } /*** META ((export #t) (peephole (values))) */ function sc_values() { - if (arguments.length === 1) - return arguments[0]; - else - return new sc_Values(arguments); + if (arguments.length === 1) return arguments[0]; + else return new sc_Values(arguments); } /*** META ((export #t)) */ function sc_callWithValues(producer, consumer) { - var produced = producer(); - if (produced instanceof sc_Values) - return consumer.apply(null, produced.values); - else - return consumer(produced); + var produced = producer(); + if (produced instanceof sc_Values) + return consumer.apply(null, produced.values); + else return consumer(produced); } /*** META ((export #t)) */ function sc_dynamicWind(before, thunk, after) { - before(); - try { - var res = thunk(); - return res; - } finally { - after(); - } + before(); + try { + var res = thunk(); + return res; + } finally { + after(); + } } - // TODO: eval/scheme-report-environment/null-environment/interaction-environment // LIMITATION: 'load' doesn't exist without files. // LIMITATION: transcript-on/transcript-off doesn't exist without files. - function sc_Struct(name) { - this.name = name; + this.name = name; } -sc_Struct.prototype.sc_toDisplayString = function() { - return "#"; +sc_Struct.prototype.sc_toDisplayString = function () { + return "#"; }; sc_Struct.prototype.sc_toWriteString = sc_Struct.prototype.sc_toDisplayString; @@ -1738,7 +1775,7 @@ sc_Struct.prototype.sc_toWriteString = sc_Struct.prototype.sc_toDisplayString; (peephole (hole 1 "new sc_Struct(" name ")"))) */ function sc_makeStruct(name) { - return new sc_Struct(name); + return new sc_Struct(name); } /*** META ((export #t) @@ -1746,7 +1783,7 @@ function sc_makeStruct(name) { (peephole (postfix " instanceof sc_Struct"))) */ function sc_isStruct(o) { - return (o instanceof sc_Struct); + return o instanceof sc_Struct; } /*** META ((export #t) @@ -1754,199 +1791,190 @@ function sc_isStruct(o) { (peephole (hole 2 "(" 1 " instanceof sc_Struct) && ( " 1 ".name === " 0 ")"))) */ function sc_isStructNamed(name, s) { - return ((s instanceof sc_Struct) && (s.name === name)); + return s instanceof sc_Struct && s.name === name; } /*** META ((export struct-field) (peephole (hole 3 0 "[" 2 "]"))) */ function sc_getStructField(s, name, field) { - return s[field]; + return s[field]; } /*** META ((export struct-field-set!) (peephole (hole 4 0 "[" 2 "] = " 3))) */ function sc_setStructFieldBang(s, name, field, val) { - s[field] = val; + s[field] = val; } /*** META ((export #t) (peephole (prefix "~"))) */ function sc_bitNot(x) { - return ~x; + return ~x; } /*** META ((export #t) (peephole (infix 2 2 "&"))) */ function sc_bitAnd(x, y) { - return x & y; + return x & y; } /*** META ((export #t) (peephole (infix 2 2 "|"))) */ function sc_bitOr(x, y) { - return x | y; + return x | y; } /*** META ((export #t) (peephole (infix 2 2 "^"))) */ function sc_bitXor(x, y) { - return x ^ y; + return x ^ y; } /*** META ((export #t) (peephole (infix 2 2 "<<"))) */ function sc_bitLsh(x, y) { - return x << y; + return x << y; } /*** META ((export #t) (peephole (infix 2 2 ">>"))) */ function sc_bitRsh(x, y) { - return x >> y; + return x >> y; } /*** META ((export #t) (peephole (infix 2 2 ">>>"))) */ function sc_bitUrsh(x, y) { - return x >>> y; + return x >>> y; } /*** META ((export js-field js-property) (peephole (hole 2 o "[" field "]"))) */ function sc_jsField(o, field) { - return o[field]; + return o[field]; } /*** META ((export js-field-set! js-property-set!) (peephole (hole 3 o "[" field "] = " val))) */ function sc_setJsFieldBang(o, field, val) { - return o[field] = val; + return (o[field] = val); } /*** META ((export js-field-delete! js-property-delete!) (peephole (hole 2 "delete" o "[" field "]"))) */ function sc_deleteJsFieldBang(o, field) { - delete o[field]; + delete o[field]; } /*** META ((export #t) (peephole (jsCall))) */ function sc_jsCall(o, fun) { - var args = new Array(); - for (var i = 2; i < arguments.length; i++) - args[i-2] = arguments[i]; - return fun.apply(o, args); + var args = new Array(); + for (var i = 2; i < arguments.length; i++) args[i - 2] = arguments[i]; + return fun.apply(o, args); } /*** META ((export #t) (peephole (jsMethodCall))) */ function sc_jsMethodCall(o, field) { - var args = new Array(); - for (var i = 2; i < arguments.length; i++) - args[i-2] = arguments[i]; - return o[field].apply(o, args); + var args = new Array(); + for (var i = 2; i < arguments.length; i++) args[i - 2] = arguments[i]; + return o[field].apply(o, args); } /*** META ((export new js-new) (peephole (jsNew))) */ function sc_jsNew(c) { - var evalStr = "new c("; - evalStr +=arguments.length > 1? "arguments[1]": ""; - for (var i = 2; i < arguments.length; i++) - evalStr += ", arguments[" + i + "]"; - evalStr +=")"; - return eval(evalStr); + var evalStr = "new c("; + evalStr += arguments.length > 1 ? "arguments[1]" : ""; + for (var i = 2; i < arguments.length; i++) + evalStr += ", arguments[" + i + "]"; + evalStr += ")"; + return eval(evalStr); } // ======================== RegExp ==================== /*** META ((export #t)) */ function sc_pregexp(re) { - return new RegExp(sc_string2jsstring(re)); + return new RegExp(sc_string2jsstring(re)); } /*** META ((export #t)) */ function sc_pregexpMatch(re, s) { - var reg = (re instanceof RegExp) ? re : sc_pregexp(re); - var tmp = reg.exec(sc_string2jsstring(s)); + var reg = re instanceof RegExp ? re : sc_pregexp(re); + var tmp = reg.exec(sc_string2jsstring(s)); - if (tmp == null) return false; + if (tmp == null) return false; - var res = null; - for (var i = tmp.length-1; i >= 0; i--) { - if (tmp[i] !== null) { - res = sc_cons(sc_jsstring2string(tmp[i]), res); - } else { - res = sc_cons(false, res); - } + var res = null; + for (var i = tmp.length - 1; i >= 0; i--) { + if (tmp[i] !== null) { + res = sc_cons(sc_jsstring2string(tmp[i]), res); + } else { + res = sc_cons(false, res); } - return res; + } + return res; } /*** META ((export #t)) */ function sc_pregexpReplace(re, s1, s2) { - var reg; - var jss1 = sc_string2jsstring(s1); - var jss2 = sc_string2jsstring(s2); - - if (re instanceof RegExp) { - if (re.global) - reg = re; - else - reg = new RegExp(re.source); - } else { - reg = new RegExp(sc_string2jsstring(re)); - } + var reg; + var jss1 = sc_string2jsstring(s1); + var jss2 = sc_string2jsstring(s2); + + if (re instanceof RegExp) { + if (re.global) reg = re; + else reg = new RegExp(re.source); + } else { + reg = new RegExp(sc_string2jsstring(re)); + } - return jss1.replace(reg, jss2); + return jss1.replace(reg, jss2); } /*** META ((export pregexp-replace*)) */ function sc_pregexpReplaceAll(re, s1, s2) { - var reg; - var jss1 = sc_string2jsstring(s1); - var jss2 = sc_string2jsstring(s2); - - if (re instanceof RegExp) { - if (re.global) - reg = re; - else - reg = new RegExp(re.source, "g"); - } else { - reg = new RegExp(sc_string2jsstring(re), "g"); - } + var reg; + var jss1 = sc_string2jsstring(s1); + var jss2 = sc_string2jsstring(s2); + + if (re instanceof RegExp) { + if (re.global) reg = re; + else reg = new RegExp(re.source, "g"); + } else { + reg = new RegExp(sc_string2jsstring(re), "g"); + } - return jss1.replace(reg, jss2); + return jss1.replace(reg, jss2); } /*** META ((export #t)) */ function sc_pregexpSplit(re, s) { - var reg = ((re instanceof RegExp) ? - re : - new RegExp(sc_string2jsstring(re))); - var jss = sc_string2jsstring(s); - var tmp = jss.split(reg); + var reg = re instanceof RegExp ? re : new RegExp(sc_string2jsstring(re)); + var jss = sc_string2jsstring(s); + var tmp = jss.split(reg); - if (tmp == null) return false; + if (tmp == null) return false; - return sc_vector2list(tmp); + return sc_vector2list(tmp); } - /* =========================================================================== */ /* Other library stuff */ /* =========================================================================== */ @@ -1955,135 +1983,119 @@ function sc_pregexpSplit(re, s) { (peephole (hole 1 "Math.floor(Math.random()*" 'n ")"))) */ function sc_random(n) { - return Math.floor(Math.random()*n); + return Math.floor(Math.random() * n); } /*** META ((export current-date) (peephole (hole 0 "new Date()"))) */ function sc_currentDate() { - return new Date(); + return new Date(); } -function sc_Hashtable() { -} -sc_Hashtable.prototype.toString = function() { - return "#{%hashtable}"; +function sc_Hashtable() {} +sc_Hashtable.prototype.toString = function () { + return "#{%hashtable}"; }; // sc_toWriteString == sc_toDisplayString == toString function sc_HashtableElement(key, val) { - this.key = key; - this.val = val; + this.key = key; + this.val = val; } /*** META ((export #t) (peephole (hole 0 "new sc_Hashtable()"))) */ function sc_makeHashtable() { - return new sc_Hashtable(); + return new sc_Hashtable(); } /*** META ((export #t)) */ function sc_hashtablePutBang(ht, key, val) { - var hash = sc_hash(key); - ht[hash] = new sc_HashtableElement(key, val); + var hash = sc_hash(key); + ht[hash] = new sc_HashtableElement(key, val); } /*** META ((export #t)) */ function sc_hashtableGet(ht, key) { - var hash = sc_hash(key); - if (hash in ht) - return ht[hash].val; - else - return false; + var hash = sc_hash(key); + if (hash in ht) return ht[hash].val; + else return false; } /*** META ((export #t)) */ function sc_hashtableForEach(ht, f) { - for (var v in ht) { - if (ht[v] instanceof sc_HashtableElement) - f(ht[v].key, ht[v].val); - } + for (var v in ht) { + if (ht[v] instanceof sc_HashtableElement) f(ht[v].key, ht[v].val); + } } /*** META ((export hashtable-contains?) (peephole (hole 2 "sc_hash(" 1 ") in " 0))) */ function sc_hashtableContains(ht, key) { - var hash = sc_hash(key); - if (hash in ht) - return true; - else - return false; + var hash = sc_hash(key); + if (hash in ht) return true; + else return false; } var SC_HASH_COUNTER = 0; function sc_hash(o) { - if (o === null) - return "null"; - else if (o === undefined) - return "undefined"; - else if (o === true) - return "true"; - else if (o === false) - return "false"; - else if (typeof o === "number") - return "num-" + o; - else if (typeof o === "string") - return "jsstr-" + o; - else if (o.sc_getHash) - return o.sc_getHash(); - else - return sc_counterHash.call(o); + if (o === null) return "null"; + else if (o === undefined) return "undefined"; + else if (o === true) return "true"; + else if (o === false) return "false"; + else if (typeof o === "number") return "num-" + o; + else if (typeof o === "string") return "jsstr-" + o; + else if (o.sc_getHash) return o.sc_getHash(); + else return sc_counterHash.call(o); } function sc_counterHash() { - if (!this.sc_hash) { - this.sc_hash = "hash-" + SC_HASH_COUNTER; - SC_HASH_COUNTER++; - } - return this.sc_hash; + if (!this.sc_hash) { + this.sc_hash = "hash-" + SC_HASH_COUNTER; + SC_HASH_COUNTER++; + } + return this.sc_hash; } function sc_Trampoline(args, maxTailCalls) { - this['__trampoline return__'] = true; - this.args = args; - this.MAX_TAIL_CALLs = maxTailCalls; + this["__trampoline return__"] = true; + this.args = args; + this.MAX_TAIL_CALLs = maxTailCalls; } // TODO: call/cc stuff -sc_Trampoline.prototype.restart = function() { - var o = this; - while (true) { - // set both globals. - SC_TAIL_OBJECT.calls = o.MAX_TAIL_CALLs-1; - var fun = o.args.callee; - var res = fun.apply(SC_TAIL_OBJECT, o.args); - if (res instanceof sc_Trampoline) - o = res; - else - return res; - } -} +sc_Trampoline.prototype.restart = function () { + var o = this; + while (true) { + // set both globals. + SC_TAIL_OBJECT.calls = o.MAX_TAIL_CALLs - 1; + var fun = o.args.callee; + var res = fun.apply(SC_TAIL_OBJECT, o.args); + if (res instanceof sc_Trampoline) o = res; + else return res; + } +}; /*** META ((export bind-exit-lambda)) */ function sc_bindExitLambda(proc) { - var escape_obj = new sc_BindExitException(); - var escape = function(res) { - escape_obj.res = res; - throw escape_obj; - }; - try { - return proc(escape); - } catch(e) { - if (e === escape_obj) { - return e.res; - } - throw e; + var escape_obj = new sc_BindExitException(); + var escape = function (res) { + escape_obj.res = res; + throw escape_obj; + }; + try { + return proc(escape); + } catch (e) { + if (e === escape_obj) { + return e.res; } + throw e; + } } function sc_BindExitException() { - this._internalException = true; + this._internalException = true; } var SC_SCM2JS_GLOBALS = new Object(); @@ -2096,474 +2108,490 @@ SC_SCM2JS_GLOBALS.TAIL_OBJECT = SC_TAIL_OBJECT; /*------------------------------------------------------------------*/ -function sc_EOF() { -} +function sc_EOF() {} var SC_EOF_OBJECT = new sc_EOF(); -function sc_Port() { -} +function sc_Port() {} /* --------------- Input ports -------------------------------------*/ -function sc_InputPort() { -} +function sc_InputPort() {} sc_InputPort.prototype = new sc_Port(); -sc_InputPort.prototype.peekChar = function() { - if (!("peeked" in this)) - this.peeked = this.getNextChar(); - return this.peeked; -} -sc_InputPort.prototype.readChar = function() { - var tmp = this.peekChar(); - delete this.peeked; - return tmp; -} -sc_InputPort.prototype.isCharReady = function() { - return true; -} -sc_InputPort.prototype.close = function() { - // do nothing -} +sc_InputPort.prototype.peekChar = function () { + if (!("peeked" in this)) this.peeked = this.getNextChar(); + return this.peeked; +}; +sc_InputPort.prototype.readChar = function () { + var tmp = this.peekChar(); + delete this.peeked; + return tmp; +}; +sc_InputPort.prototype.isCharReady = function () { + return true; +}; +sc_InputPort.prototype.close = function () { + // do nothing +}; /* .............. String port ..........................*/ -function sc_ErrorInputPort() { -}; +function sc_ErrorInputPort() {} sc_ErrorInputPort.prototype = new sc_InputPort(); -sc_ErrorInputPort.prototype.getNextChar = function() { - throw "can't read from error-port."; +sc_ErrorInputPort.prototype.getNextChar = function () { + throw "can't read from error-port."; }; -sc_ErrorInputPort.prototype.isCharReady = function() { - return false; +sc_ErrorInputPort.prototype.isCharReady = function () { + return false; }; - /* .............. String port ..........................*/ function sc_StringInputPort(jsStr) { - // we are going to do some charAts on the str. - // instead of recreating all the time a String-object, we - // create one in the beginning. (not sure, if this is really an optim) - this.str = new String(jsStr); - this.pos = 0; + // we are going to do some charAts on the str. + // instead of recreating all the time a String-object, we + // create one in the beginning. (not sure, if this is really an optim) + this.str = new String(jsStr); + this.pos = 0; } sc_StringInputPort.prototype = new sc_InputPort(); -sc_StringInputPort.prototype.getNextChar = function() { - if (this.pos >= this.str.length) - return SC_EOF_OBJECT; - return this.str.charAt(this.pos++); +sc_StringInputPort.prototype.getNextChar = function () { + if (this.pos >= this.str.length) return SC_EOF_OBJECT; + return this.str.charAt(this.pos++); }; /* ------------- Read and other lib-funs -------------------------------*/ function sc_Token(type, val, pos) { - this.type = type; - this.val = val; - this.pos = pos; -} -sc_Token.EOF = 0/*EOF*/; -sc_Token.OPEN_PAR = 1/*OPEN_PAR*/; -sc_Token.CLOSE_PAR = 2/*CLOSE_PAR*/; -sc_Token.OPEN_BRACE = 3/*OPEN_BRACE*/; -sc_Token.CLOSE_BRACE = 4/*CLOSE_BRACE*/; -sc_Token.OPEN_BRACKET = 5/*OPEN_BRACKET*/; -sc_Token.CLOSE_BRACKET = 6/*CLOSE_BRACKET*/; -sc_Token.WHITESPACE = 7/*WHITESPACE*/; -sc_Token.QUOTE = 8/*QUOTE*/; -sc_Token.ID = 9/*ID*/; -sc_Token.DOT = 10/*DOT*/; -sc_Token.STRING = 11/*STRING*/; -sc_Token.NUMBER = 12/*NUMBER*/; -sc_Token.ERROR = 13/*ERROR*/; -sc_Token.VECTOR_BEGIN = 14/*VECTOR_BEGIN*/; -sc_Token.TRUE = 15/*TRUE*/; -sc_Token.FALSE = 16/*FALSE*/; -sc_Token.UNSPECIFIED = 17/*UNSPECIFIED*/; -sc_Token.REFERENCE = 18/*REFERENCE*/; -sc_Token.STORE = 19/*STORE*/; -sc_Token.CHAR = 20/*CHAR*/; + this.type = type; + this.val = val; + this.pos = pos; +} +sc_Token.EOF = 0 /*EOF*/; +sc_Token.OPEN_PAR = 1 /*OPEN_PAR*/; +sc_Token.CLOSE_PAR = 2 /*CLOSE_PAR*/; +sc_Token.OPEN_BRACE = 3 /*OPEN_BRACE*/; +sc_Token.CLOSE_BRACE = 4 /*CLOSE_BRACE*/; +sc_Token.OPEN_BRACKET = 5 /*OPEN_BRACKET*/; +sc_Token.CLOSE_BRACKET = 6 /*CLOSE_BRACKET*/; +sc_Token.WHITESPACE = 7 /*WHITESPACE*/; +sc_Token.QUOTE = 8 /*QUOTE*/; +sc_Token.ID = 9 /*ID*/; +sc_Token.DOT = 10 /*DOT*/; +sc_Token.STRING = 11 /*STRING*/; +sc_Token.NUMBER = 12 /*NUMBER*/; +sc_Token.ERROR = 13 /*ERROR*/; +sc_Token.VECTOR_BEGIN = 14 /*VECTOR_BEGIN*/; +sc_Token.TRUE = 15 /*TRUE*/; +sc_Token.FALSE = 16 /*FALSE*/; +sc_Token.UNSPECIFIED = 17 /*UNSPECIFIED*/; +sc_Token.REFERENCE = 18 /*REFERENCE*/; +sc_Token.STORE = 19 /*STORE*/; +sc_Token.CHAR = 20 /*CHAR*/; var SC_ID_CLASS = SC_LOWER_CLASS + SC_UPPER_CLASS + "!$%*+-./:<=>?@^_~"; function sc_Tokenizer(port) { - this.port = port; -} -sc_Tokenizer.prototype.peekToken = function() { - if (this.peeked) - return this.peeked; - var newToken = this.nextToken(); - this.peeked = newToken; - return newToken; + this.port = port; +} +sc_Tokenizer.prototype.peekToken = function () { + if (this.peeked) return this.peeked; + var newToken = this.nextToken(); + this.peeked = newToken; + return newToken; }; -sc_Tokenizer.prototype.readToken = function() { - var tmp = this.peekToken(); - delete this.peeked; - return tmp; +sc_Tokenizer.prototype.readToken = function () { + var tmp = this.peekToken(); + delete this.peeked; + return tmp; }; -sc_Tokenizer.prototype.nextToken = function() { - var port = this.port; - - function isNumberChar(c) { - return (c >= "0" && c <= "9"); - }; - function isIdOrNumberChar(c) { - return SC_ID_CLASS.indexOf(c) != -1 || // ID-char - (c >= "0" && c <= "9"); +sc_Tokenizer.prototype.nextToken = function () { + var port = this.port; + + function isNumberChar(c) { + return c >= "0" && c <= "9"; + } + function isIdOrNumberChar(c) { + return ( + SC_ID_CLASS.indexOf(c) != -1 || // ID-char + (c >= "0" && c <= "9") + ); + } + function isWhitespace(c) { + return c === " " || c === "\r" || c === "\n" || c === "\t" || c === "\f"; + } + function isWhitespaceOrEOF(c) { + return isWhitespace(c) || c === SC_EOF_OBJECT; + } + + function readString() { + res = ""; + while (true) { + var c = port.readChar(); + switch (c) { + case '"': + return new sc_Token(11 /*STRING*/, res); + case "\\": + var tmp = port.readChar(); + switch (tmp) { + case "0": + res += "\0"; + break; + case "a": + res += "a"; + break; + case "b": + res += "\b"; + break; + case "f": + res += "\f"; + break; + case "n": + res += "\n"; + break; + case "r": + res += "\r"; + break; + case "t": + res += "\t"; + break; + case "v": + res += "\v"; + break; + case '"': + res += '"'; + break; + case "\\": + res += "\\"; + break; + case "x": + /* hexa-number */ + var nb = 0; + while (true) { + var hexC = port.peekChar(); + if (hexC >= "0" && hexC <= "9") { + port.readChar(); + nb = nb * 16 + hexC.charCodeAt(0) - "0".charCodeAt(0); + } else if (hexC >= "a" && hexC <= "f") { + port.readChar(); + nb = nb * 16 + hexC.charCodeAt(0) - "a".charCodeAt(0); + } else if (hexC >= "A" && hexC <= "F") { + port.readChar(); + nb = nb * 16 + hexC.charCodeAt(0) - "A".charCodeAt(0); + } else { + // next char isn't part of hex. + res += String.fromCharCode(nb); + break; + } + } + break; + default: + if (tmp === SC_EOF_OBJECT) { + return new sc_Token( + 13 /*ERROR*/, + "unclosed string-literal" + res + ); + } + res += tmp; + } + break; + default: + if (c === SC_EOF_OBJECT) { + return new sc_Token(13 /*ERROR*/, "unclosed string-literal" + res); + } + res += c; + } } - function isWhitespace(c) { - return c === " " || c === "\r" || c === "\n" || c === "\t" || c === "\f"; - }; - function isWhitespaceOrEOF(c) { - return isWhitespace(c) || c === SC_EOF_OBJECT; - }; - - function readString() { - res = ""; - while (true) { - var c = port.readChar(); - switch (c) { - case '"': - return new sc_Token(11/*STRING*/, res); - case "\\": - var tmp = port.readChar(); - switch (tmp) { - case '0': res += "\0"; break; - case 'a': res += "\a"; break; - case 'b': res += "\b"; break; - case 'f': res += "\f"; break; - case 'n': res += "\n"; break; - case 'r': res += "\r"; break; - case 't': res += "\t"; break; - case 'v': res += "\v"; break; - case '"': res += '"'; break; - case '\\': res += '\\'; break; - case 'x': - /* hexa-number */ - var nb = 0; - while (true) { - var hexC = port.peekChar(); - if (hexC >= '0' && hexC <= '9') { - port.readChar(); - nb = nb * 16 + hexC.charCodeAt(0) - '0'.charCodeAt(0); - } else if (hexC >= 'a' && hexC <= 'f') { - port.readChar(); - nb = nb * 16 + hexC.charCodeAt(0) - 'a'.charCodeAt(0); - } else if (hexC >= 'A' && hexC <= 'F') { - port.readChar(); - nb = nb * 16 + hexC.charCodeAt(0) - 'A'.charCodeAt(0); - } else { - // next char isn't part of hex. - res += String.fromCharCode(nb); - break; - } - } - break; - default: - if (tmp === SC_EOF_OBJECT) { - return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res); - } - res += tmp; - } - break; - default: - if (c === SC_EOF_OBJECT) { - return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res); - } - res += c; - } - } - }; - function readIdOrNumber(firstChar) { - var res = firstChar; - while (isIdOrNumberChar(port.peekChar())) - res += port.readChar(); - if (isNaN(res)) - return new sc_Token(9/*ID*/, res); - else - return new sc_Token(12/*NUMBER*/, res - 0); - }; - - function skipWhitespaceAndComments() { - var done = false; - while (!done) { - done = true; - while (isWhitespace(port.peekChar())) - port.readChar(); - if (port.peekChar() === ';') { - port.readChar(); - done = false; - while (true) { - curChar = port.readChar(); - if (curChar === SC_EOF_OBJECT || - curChar === '\n') - break; - } - } - } - }; - - function readDot() { - if (isWhitespace(port.peekChar())) - return new sc_Token(10/*DOT*/); - else - return readIdOrNumber("."); - }; - - function readSharp() { - var c = port.readChar(); - if (isWhitespace(c)) - return new sc_Token(13/*ERROR*/, "bad #-pattern0."); - - // reference - if (isNumberChar(c)) { - var nb = c - 0; - while (isNumberChar(port.peekChar())) - nb = nb*10 + (port.readChar() - 0); - switch (port.readChar()) { - case '#': - return new sc_Token(18/*REFERENCE*/, nb); - case '=': - return new sc_Token(19/*STORE*/, nb); - default: - return new sc_Token(13/*ERROR*/, "bad #-pattern1." + nb); - } - } - - if (c === "(") - return new sc_Token(14/*VECTOR_BEGIN*/); - - if (c === "\\") { // character - var tmp = "" - while (!isWhitespaceOrEOF(port.peekChar())) - tmp += port.readChar(); - switch (tmp.length) { - case 0: // it's escaping a whitespace char: - if (sc_isEOFObject(port.peekChar)) - return new sc_Token(13/*ERROR*/, "bad #-pattern2."); - else - return new sc_Token(20/*CHAR*/, port.readChar()); - case 1: - return new sc_Token(20/*CHAR*/, tmp); - default: - var entry = sc_Char.readable2char[tmp.toLowerCase()]; - if (entry) - return new sc_Token(20/*CHAR*/, entry); - else - return new sc_Token(13/*ERROR*/, "unknown character description: #\\" + tmp); - } - } - - // some constants (#t, #f, #unspecified) - var res; - var needing; - switch (c) { - case 't': res = new sc_Token(15/*TRUE*/, true); needing = ""; break; - case 'f': res = new sc_Token(16/*FALSE*/, false); needing = ""; break; - case 'u': res = new sc_Token(17/*UNSPECIFIED*/, undefined); needing = "nspecified"; break; - default: - return new sc_Token(13/*ERROR*/, "bad #-pattern3: " + c); - } - while(true) { - c = port.peekChar(); - if ((isWhitespaceOrEOF(c) || c === ')') && - needing == "") - return res; - else if (isWhitespace(c) || needing == "") - return new sc_Token(13/*ERROR*/, "bad #-pattern4 " + c + " " + needing); - else if (needing.charAt(0) == c) { - port.readChar(); // consume - needing = needing.slice(1); - } else - return new sc_Token(13/*ERROR*/, "bad #-pattern5"); - } - - }; + } + function readIdOrNumber(firstChar) { + var res = firstChar; + while (isIdOrNumberChar(port.peekChar())) res += port.readChar(); + if (isNaN(res)) return new sc_Token(9 /*ID*/, res); + else return new sc_Token(12 /*NUMBER*/, res - 0); + } - skipWhitespaceAndComments(); - var curChar = port.readChar(); - if (curChar === SC_EOF_OBJECT) - return new sc_Token(0/*EOF*/, curChar); - switch (curChar) - { + function skipWhitespaceAndComments() { + var done = false; + while (!done) { + done = true; + while (isWhitespace(port.peekChar())) port.readChar(); + if (port.peekChar() === ";") { + port.readChar(); + done = false; + while (true) { + curChar = port.readChar(); + if (curChar === SC_EOF_OBJECT || curChar === "\n") break; + } + } + } + } + + function readDot() { + if (isWhitespace(port.peekChar())) return new sc_Token(10 /*DOT*/); + else return readIdOrNumber("."); + } + + function readSharp() { + var c = port.readChar(); + if (isWhitespace(c)) return new sc_Token(13 /*ERROR*/, "bad #-pattern0."); + + // reference + if (isNumberChar(c)) { + var nb = c - 0; + while (isNumberChar(port.peekChar())) + nb = nb * 10 + (port.readChar() - 0); + switch (port.readChar()) { + case "#": + return new sc_Token(18 /*REFERENCE*/, nb); + case "=": + return new sc_Token(19 /*STORE*/, nb); + default: + return new sc_Token(13 /*ERROR*/, "bad #-pattern1." + nb); + } + } + + if (c === "(") return new sc_Token(14 /*VECTOR_BEGIN*/); + + if (c === "\\") { + // character + var tmp = ""; + while (!isWhitespaceOrEOF(port.peekChar())) tmp += port.readChar(); + switch (tmp.length) { + case 0: // it's escaping a whitespace char: + if (sc_isEOFObject(port.peekChar)) + return new sc_Token(13 /*ERROR*/, "bad #-pattern2."); + else return new sc_Token(20 /*CHAR*/, port.readChar()); + case 1: + return new sc_Token(20 /*CHAR*/, tmp); + default: + var entry = sc_Char.readable2char[tmp.toLowerCase()]; + if (entry) return new sc_Token(20 /*CHAR*/, entry); + else + return new sc_Token( + 13 /*ERROR*/, + "unknown character description: #\\" + tmp + ); + } + } + + // some constants (#t, #f, #unspecified) + var res; + var needing; + switch (c) { + case "t": + res = new sc_Token(15 /*TRUE*/, true); + needing = ""; + break; + case "f": + res = new sc_Token(16 /*FALSE*/, false); + needing = ""; + break; + case "u": + res = new sc_Token(17 /*UNSPECIFIED*/, undefined); + needing = "nspecified"; + break; + default: + return new sc_Token(13 /*ERROR*/, "bad #-pattern3: " + c); + } + while (true) { + c = port.peekChar(); + if ((isWhitespaceOrEOF(c) || c === ")") && needing == "") return res; + else if (isWhitespace(c) || needing == "") + return new sc_Token( + 13 /*ERROR*/, + "bad #-pattern4 " + c + " " + needing + ); + else if (needing.charAt(0) == c) { + port.readChar(); // consume + needing = needing.slice(1); + } else return new sc_Token(13 /*ERROR*/, "bad #-pattern5"); + } + } + + skipWhitespaceAndComments(); + var curChar = port.readChar(); + if (curChar === SC_EOF_OBJECT) return new sc_Token(0 /*EOF*/, curChar); + switch (curChar) { case " ": case "\n": case "\t": - return readWhitespace(); + return readWhitespace(); case "(": - return new sc_Token(1/*OPEN_PAR*/); + return new sc_Token(1 /*OPEN_PAR*/); case ")": - return new sc_Token(2/*CLOSE_PAR*/); + return new sc_Token(2 /*CLOSE_PAR*/); case "{": - return new sc_Token(3/*OPEN_BRACE*/); + return new sc_Token(3 /*OPEN_BRACE*/); case "}": - return new sc_Token(4/*CLOSE_BRACE*/); + return new sc_Token(4 /*CLOSE_BRACE*/); case "[": - return new sc_Token(5/*OPEN_BRACKET*/); + return new sc_Token(5 /*OPEN_BRACKET*/); case "]": - return new sc_Token(6/*CLOSE_BRACKET*/); + return new sc_Token(6 /*CLOSE_BRACKET*/); case "'": - return new sc_Token(8/*QUOTE*/); + return new sc_Token(8 /*QUOTE*/); case "#": - return readSharp(); + return readSharp(); case ".": - return readDot(); + return readDot(); case '"': - return readString(); + return readString(); default: - if (isIdOrNumberChar(curChar)) - return readIdOrNumber(curChar); - throw "unexpected character: " + curChar; - } + if (isIdOrNumberChar(curChar)) return readIdOrNumber(curChar); + throw "unexpected character: " + curChar; + } }; function sc_Reader(tokenizer) { - this.tokenizer = tokenizer; - this.backref = new Array(); -} -sc_Reader.prototype.read = function() { - function readList(listBeginType) { - function matchesPeer(open, close) { - return open === 1/*OPEN_PAR*/ && close === 2/*CLOSE_PAR*/ - || open === 3/*OPEN_BRACE*/ && close === 4/*CLOSE_BRACE*/ - || open === 5/*OPEN_BRACKET*/ && close === 6/*CLOSE_BRACKET*/; - }; - var res = null; - - while (true) { - var token = tokenizer.peekToken(); - - switch (token.type) { - case 2/*CLOSE_PAR*/: - case 4/*CLOSE_BRACE*/: - case 6/*CLOSE_BRACKET*/: - if (matchesPeer(listBeginType, token.type)) { - tokenizer.readToken(); // consume token - return sc_reverseBang(res); - } else - throw "closing par doesn't match: " + listBeginType - + " " + listEndType; - - case 0/*EOF*/: - throw "unexpected end of file"; - - case 10/*DOT*/: - tokenizer.readToken(); // consume token - var cdr = this.read(); - var par = tokenizer.readToken(); - if (!matchesPeer(listBeginType, par.type)) - throw "closing par doesn't match: " + listBeginType - + " " + par.type; - else - return sc_reverseAppendBang(res, cdr); - - - default: - res = sc_cons(this.read(), res); - } - } - }; - function readQuote() { - return sc_cons("quote", sc_cons(this.read(), null)); - }; - function readVector() { - // opening-parenthesis is already consumed - var a = new Array(); - while (true) { - var token = tokenizer.peekToken(); - switch (token.type) { - case 2/*CLOSE_PAR*/: - tokenizer.readToken(); - return a; - - default: - a.push(this.read()); - } - } - }; - - function storeRefence(nb) { - var tmp = this.read(); - this.backref[nb] = tmp; - return tmp; - }; - - function readReference(nb) { - if (nb in this.backref) - return this.backref[nb]; - else - throw "bad reference: " + nb; - }; - - var tokenizer = this.tokenizer; - - var token = tokenizer.readToken(); - - // handle error - if (token.type === 13/*ERROR*/) - throw token.val; - - switch (token.type) { - case 1/*OPEN_PAR*/: - case 3/*OPEN_BRACE*/: - case 5/*OPEN_BRACKET*/: - return readList.call(this, token.type); - case 8/*QUOTE*/: - return readQuote.call(this); - case 11/*STRING*/: - return sc_jsstring2string(token.val); - case 20/*CHAR*/: - return new sc_Char(token.val); - case 14/*VECTOR_BEGIN*/: - return readVector.call(this); - case 18/*REFERENCE*/: - return readReference.call(this, token.val); - case 19/*STORE*/: - return storeRefence.call(this, token.val); - case 9/*ID*/: - return sc_jsstring2symbol(token.val); - case 0/*EOF*/: - case 12/*NUMBER*/: - case 15/*TRUE*/: - case 16/*FALSE*/: - case 17/*UNSPECIFIED*/: - return token.val; - default: - throw "unexpected token " + token.type + " " + token.val; + this.tokenizer = tokenizer; + this.backref = new Array(); +} +sc_Reader.prototype.read = function () { + function readList(listBeginType) { + function matchesPeer(open, close) { + return ( + (open === 1 /*OPEN_PAR*/ && close === 2) /*CLOSE_PAR*/ || + (open === 3 /*OPEN_BRACE*/ && close === 4) /*CLOSE_BRACE*/ || + (open === 5 /*OPEN_BRACKET*/ && close === 6) /*CLOSE_BRACKET*/ + ); + } + var res = null; + + while (true) { + var token = tokenizer.peekToken(); + + switch (token.type) { + case 2 /*CLOSE_PAR*/: + case 4 /*CLOSE_BRACE*/: + case 6 /*CLOSE_BRACKET*/: + if (matchesPeer(listBeginType, token.type)) { + tokenizer.readToken(); // consume token + return sc_reverseBang(res); + } else + throw ( + "closing par doesn't match: " + listBeginType + " " + listEndType + ); + + case 0 /*EOF*/: + throw "unexpected end of file"; + + case 10 /*DOT*/: + tokenizer.readToken(); // consume token + var cdr = this.read(); + var par = tokenizer.readToken(); + if (!matchesPeer(listBeginType, par.type)) + throw ( + "closing par doesn't match: " + listBeginType + " " + par.type + ); + else return sc_reverseAppendBang(res, cdr); + + default: + res = sc_cons(this.read(), res); + } } + } + function readQuote() { + return sc_cons("quote", sc_cons(this.read(), null)); + } + function readVector() { + // opening-parenthesis is already consumed + var a = new Array(); + while (true) { + var token = tokenizer.peekToken(); + switch (token.type) { + case 2 /*CLOSE_PAR*/: + tokenizer.readToken(); + return a; + + default: + a.push(this.read()); + } + } + } + + function storeRefence(nb) { + var tmp = this.read(); + this.backref[nb] = tmp; + return tmp; + } + + function readReference(nb) { + if (nb in this.backref) return this.backref[nb]; + else throw "bad reference: " + nb; + } + + var tokenizer = this.tokenizer; + + var token = tokenizer.readToken(); + + // handle error + if (token.type === 13 /*ERROR*/) throw token.val; + + switch (token.type) { + case 1 /*OPEN_PAR*/: + case 3 /*OPEN_BRACE*/: + case 5 /*OPEN_BRACKET*/: + return readList.call(this, token.type); + case 8 /*QUOTE*/: + return readQuote.call(this); + case 11 /*STRING*/: + return sc_jsstring2string(token.val); + case 20 /*CHAR*/: + return new sc_Char(token.val); + case 14 /*VECTOR_BEGIN*/: + return readVector.call(this); + case 18 /*REFERENCE*/: + return readReference.call(this, token.val); + case 19 /*STORE*/: + return storeRefence.call(this, token.val); + case 9 /*ID*/: + return sc_jsstring2symbol(token.val); + case 0 /*EOF*/: + case 12 /*NUMBER*/: + case 15 /*TRUE*/: + case 16 /*FALSE*/: + case 17 /*UNSPECIFIED*/: + return token.val; + default: + throw "unexpected token " + token.type + " " + token.val; + } }; /*** META ((export #t)) */ function sc_read(port) { - if (port === undefined) // we assume the port hasn't been given. - port = SC_DEFAULT_IN; // THREAD: shared var... - var reader = new sc_Reader(new sc_Tokenizer(port)); - return reader.read(); + if (port === undefined) + // we assume the port hasn't been given. + port = SC_DEFAULT_IN; // THREAD: shared var... + var reader = new sc_Reader(new sc_Tokenizer(port)); + return reader.read(); } /*** META ((export #t)) */ function sc_readChar(port) { - if (port === undefined) // we assume the port hasn't been given. - port = SC_DEFAULT_IN; // THREAD: shared var... - var t = port.readChar(); - return t === SC_EOF_OBJECT? t: new sc_Char(t); + if (port === undefined) + // we assume the port hasn't been given. + port = SC_DEFAULT_IN; // THREAD: shared var... + var t = port.readChar(); + return t === SC_EOF_OBJECT ? t : new sc_Char(t); } /*** META ((export #t)) */ function sc_peekChar(port) { - if (port === undefined) // we assume the port hasn't been given. - port = SC_DEFAULT_IN; // THREAD: shared var... - var t = port.peekChar(); - return t === SC_EOF_OBJECT? t: new sc_Char(t); + if (port === undefined) + // we assume the port hasn't been given. + port = SC_DEFAULT_IN; // THREAD: shared var... + var t = port.peekChar(); + return t === SC_EOF_OBJECT ? t : new sc_Char(t); } /*** META ((export #t) (type bool)) */ function sc_isCharReady(port) { - if (port === undefined) // we assume the port hasn't been given. - port = SC_DEFAULT_IN; // THREAD: shared var... - return port.isCharReady(); + if (port === undefined) + // we assume the port hasn't been given. + port = SC_DEFAULT_IN; // THREAD: shared var... + return port.isCharReady(); } /*** META ((export #t) (peephole (postfix ".close()"))) */ function sc_closeInputPort(p) { - return p.close(); + return p.close(); } /*** META ((export #t) @@ -2571,7 +2599,7 @@ function sc_closeInputPort(p) { (peephole (postfix " instanceof sc_InputPort"))) */ function sc_isInputPort(o) { - return (o instanceof sc_InputPort); + return o instanceof sc_InputPort; } /*** META ((export eof-object?) @@ -2579,165 +2607,162 @@ function sc_isInputPort(o) { (peephole (postfix " === SC_EOF_OBJECT"))) */ function sc_isEOFObject(o) { - return o === SC_EOF_OBJECT; + return o === SC_EOF_OBJECT; } /*** META ((export #t) (peephole (hole 0 "SC_DEFAULT_IN"))) */ function sc_currentInputPort() { - return SC_DEFAULT_IN; + return SC_DEFAULT_IN; } /* ------------ file operations are not supported -----------*/ /*** META ((export #t)) */ function sc_callWithInputFile(s, proc) { - throw "can't open " + s; + throw "can't open " + s; } /*** META ((export #t)) */ function sc_callWithOutputFile(s, proc) { - throw "can't open " + s; + throw "can't open " + s; } /*** META ((export #t)) */ function sc_withInputFromFile(s, thunk) { - throw "can't open " + s; + throw "can't open " + s; } /*** META ((export #t)) */ function sc_withOutputToFile(s, thunk) { - throw "can't open " + s; + throw "can't open " + s; } /*** META ((export #t)) */ function sc_openInputFile(s) { - throw "can't open " + s; + throw "can't open " + s; } /*** META ((export #t)) */ function sc_openOutputFile(s) { - throw "can't open " + s; + throw "can't open " + s; } /* ----------------------------------------------------------------------------*/ /*** META ((export #t)) */ function sc_basename(p) { - var i = p.lastIndexOf('/'); + var i = p.lastIndexOf("/"); - if(i >= 0) - return p.substring(i + 1, p.length); - else - return ''; + if (i >= 0) return p.substring(i + 1, p.length); + else return ""; } /*** META ((export #t)) */ function sc_dirname(p) { - var i = p.lastIndexOf('/'); + var i = p.lastIndexOf("/"); - if(i >= 0) - return p.substring(0, i); - else - return ''; + if (i >= 0) return p.substring(0, i); + else return ""; } /* ----------------------------------------------------------------------------*/ /*** META ((export #t)) */ function sc_withInputFromPort(p, thunk) { - try { - var tmp = SC_DEFAULT_IN; // THREAD: shared var. - SC_DEFAULT_IN = p; - return thunk(); - } finally { - SC_DEFAULT_IN = tmp; - } + try { + var tmp = SC_DEFAULT_IN; // THREAD: shared var. + SC_DEFAULT_IN = p; + return thunk(); + } finally { + SC_DEFAULT_IN = tmp; + } } /*** META ((export #t)) */ function sc_withInputFromString(s, thunk) { - return sc_withInputFromPort(new sc_StringInputPort(sc_string2jsstring(s)), thunk); + return sc_withInputFromPort( + new sc_StringInputPort(sc_string2jsstring(s)), + thunk + ); } /*** META ((export #t)) */ function sc_withOutputToPort(p, thunk) { - try { - var tmp = SC_DEFAULT_OUT; // THREAD: shared var. - SC_DEFAULT_OUT = p; - return thunk(); - } finally { - SC_DEFAULT_OUT = tmp; - } + try { + var tmp = SC_DEFAULT_OUT; // THREAD: shared var. + SC_DEFAULT_OUT = p; + return thunk(); + } finally { + SC_DEFAULT_OUT = tmp; + } } /*** META ((export #t)) */ function sc_withOutputToString(thunk) { - var p = new sc_StringOutputPort(); - sc_withOutputToPort(p, thunk); - return p.close(); + var p = new sc_StringOutputPort(); + sc_withOutputToPort(p, thunk); + return p.close(); } /*** META ((export #t)) */ function sc_withOutputToProcedure(proc, thunk) { - var t = function(s) { proc(sc_jsstring2string(s)); }; - return sc_withOutputToPort(new sc_GenericOutputPort(t), thunk); + var t = function (s) { + proc(sc_jsstring2string(s)); + }; + return sc_withOutputToPort(new sc_GenericOutputPort(t), thunk); } /*** META ((export #t) (peephole (hole 0 "new sc_StringOutputPort()"))) */ function sc_openOutputString() { - return new sc_StringOutputPort(); + return new sc_StringOutputPort(); } /*** META ((export #t)) */ function sc_openInputString(str) { - return new sc_StringInputPort(sc_string2jsstring(str)); + return new sc_StringInputPort(sc_string2jsstring(str)); } /* ----------------------------------------------------------------------------*/ -function sc_OutputPort() { -} +function sc_OutputPort() {} sc_OutputPort.prototype = new sc_Port(); -sc_OutputPort.prototype.appendJSString = function(obj) { - /* do nothing */ -} -sc_OutputPort.prototype.close = function() { - /* do nothing */ -} +sc_OutputPort.prototype.appendJSString = function (obj) { + /* do nothing */ +}; +sc_OutputPort.prototype.close = function () { + /* do nothing */ +}; function sc_StringOutputPort() { - this.res = ""; + this.res = ""; } sc_StringOutputPort.prototype = new sc_OutputPort(); -sc_StringOutputPort.prototype.appendJSString = function(s) { - this.res += s; -} -sc_StringOutputPort.prototype.close = function() { - return sc_jsstring2string(this.res); -} +sc_StringOutputPort.prototype.appendJSString = function (s) { + this.res += s; +}; +sc_StringOutputPort.prototype.close = function () { + return sc_jsstring2string(this.res); +}; /*** META ((export #t)) */ function sc_getOutputString(sp) { - return sc_jsstring2string(sp.res); + return sc_jsstring2string(sp.res); } - -function sc_ErrorOutputPort() { -} +function sc_ErrorOutputPort() {} sc_ErrorOutputPort.prototype = new sc_OutputPort(); -sc_ErrorOutputPort.prototype.appendJSString = function(s) { - throw "don't write on ErrorPort!"; -} -sc_ErrorOutputPort.prototype.close = function() { - /* do nothing */ -} +sc_ErrorOutputPort.prototype.appendJSString = function (s) { + throw "don't write on ErrorPort!"; +}; +sc_ErrorOutputPort.prototype.close = function () { + /* do nothing */ +}; function sc_GenericOutputPort(appendJSString, close) { - this.appendJSString = appendJSString; - if (close) - this.close = close; + this.appendJSString = appendJSString; + if (close) this.close = close; } sc_GenericOutputPort.prototype = new sc_OutputPort(); @@ -2746,359 +2771,391 @@ sc_GenericOutputPort.prototype = new sc_OutputPort(); (peephole (postfix " instanceof sc_OutputPort"))) */ function sc_isOutputPort(o) { - return (o instanceof sc_OutputPort); + return o instanceof sc_OutputPort; } /*** META ((export #t) (peephole (postfix ".close()"))) */ function sc_closeOutputPort(p) { - return p.close(); + return p.close(); } /* ------------------ write ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_write(o, p) { - if (p === undefined) // we assume not given - p = SC_DEFAULT_OUT; - p.appendJSString(sc_toWriteString(o)); + if (p === undefined) + // we assume not given + p = SC_DEFAULT_OUT; + p.appendJSString(sc_toWriteString(o)); } function sc_toWriteString(o) { - if (o === null) - return "()"; - else if (o === true) - return "#t"; - else if (o === false) - return "#f"; - else if (o === undefined) - return "#unspecified"; - else if (typeof o === 'function') - return "#"; - else if (o.sc_toWriteString) - return o.sc_toWriteString(); - else - return o.toString(); + if (o === null) return "()"; + else if (o === true) return "#t"; + else if (o === false) return "#f"; + else if (o === undefined) return "#unspecified"; + else if (typeof o === "function") return "#"; + else if (o.sc_toWriteString) return o.sc_toWriteString(); + else return o.toString(); } function sc_escapeWriteString(s) { - var res = ""; - var j = 0; - for (i = 0; i < s.length; i++) { - switch (s.charAt(i)) { - case "\0": res += s.substring(j, i) + "\\0"; j = i + 1; break; - case "\b": res += s.substring(j, i) + "\\b"; j = i + 1; break; - case "\f": res += s.substring(j, i) + "\\f"; j = i + 1; break; - case "\n": res += s.substring(j, i) + "\\n"; j = i + 1; break; - case "\r": res += s.substring(j, i) + "\\r"; j = i + 1; break; - case "\t": res += s.substring(j, i) + "\\t"; j = i + 1; break; - case "\v": res += s.substring(j, i) + "\\v"; j = i + 1; break; - case '"': res += s.substring(j, i) + '\\"'; j = i + 1; break; - case "\\": res += s.substring(j, i) + "\\\\"; j = i + 1; break; - default: - var c = s.charAt(i); - if ("\a" !== "a" && c == "\a") { - res += s.substring(j, i) + "\\a"; j = i + 1; continue; - } - if ("\v" !== "v" && c == "\v") { - res += s.substring(j, i) + "\\v"; j = i + 1; continue; - } - //if (s.charAt(i) < ' ' || s.charCodeAt(i) > 127) { - // CARE: Manuel is this OK with HOP? - if (s.charAt(i) < ' ') { - /* non printable character and special chars */ - res += s.substring(j, i) + "\\x" + s.charCodeAt(i).toString(16); - j = i + 1; - } - // else just let i increase... - } + var res = ""; + var j = 0; + for (i = 0; i < s.length; i++) { + switch (s.charAt(i)) { + case "\0": + res += s.substring(j, i) + "\\0"; + j = i + 1; + break; + case "\b": + res += s.substring(j, i) + "\\b"; + j = i + 1; + break; + case "\f": + res += s.substring(j, i) + "\\f"; + j = i + 1; + break; + case "\n": + res += s.substring(j, i) + "\\n"; + j = i + 1; + break; + case "\r": + res += s.substring(j, i) + "\\r"; + j = i + 1; + break; + case "\t": + res += s.substring(j, i) + "\\t"; + j = i + 1; + break; + case "\v": + res += s.substring(j, i) + "\\v"; + j = i + 1; + break; + case '"': + res += s.substring(j, i) + '\\"'; + j = i + 1; + break; + case "\\": + res += s.substring(j, i) + "\\\\"; + j = i + 1; + break; + default: + var c = s.charAt(i); + if ("a" !== "a" && c == "a") { + res += s.substring(j, i) + "\\a"; + j = i + 1; + continue; + } + if ("\v" !== "v" && c == "\v") { + res += s.substring(j, i) + "\\v"; + j = i + 1; + continue; + } + //if (s.charAt(i) < ' ' || s.charCodeAt(i) > 127) { + // CARE: Manuel is this OK with HOP? + if (s.charAt(i) < " ") { + /* non printable character and special chars */ + res += s.substring(j, i) + "\\x" + s.charCodeAt(i).toString(16); + j = i + 1; + } + // else just let i increase... } - res += s.substring(j, i); - return res; + } + res += s.substring(j, i); + return res; } /* ------------------ display ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_display(o, p) { - if (p === undefined) // we assume not given - p = SC_DEFAULT_OUT; - p.appendJSString(sc_toDisplayString(o)); + if (p === undefined) + // we assume not given + p = SC_DEFAULT_OUT; + p.appendJSString(sc_toDisplayString(o)); } function sc_toDisplayString(o) { - if (o === null) - return "()"; - else if (o === true) - return "#t"; - else if (o === false) - return "#f"; - else if (o === undefined) - return "#unspecified"; - else if (typeof o === 'function') - return "#"; - else if (o.sc_toDisplayString) - return o.sc_toDisplayString(); - else - return o.toString(); + if (o === null) return "()"; + else if (o === true) return "#t"; + else if (o === false) return "#f"; + else if (o === undefined) return "#unspecified"; + else if (typeof o === "function") return "#"; + else if (o.sc_toDisplayString) return o.sc_toDisplayString(); + else return o.toString(); } /* ------------------ newline ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_newline(p) { - if (p === undefined) // we assume not given - p = SC_DEFAULT_OUT; - p.appendJSString("\n"); + if (p === undefined) + // we assume not given + p = SC_DEFAULT_OUT; + p.appendJSString("\n"); } /* ------------------ write-char ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_writeChar(c, p) { - if (p === undefined) // we assume not given - p = SC_DEFAULT_OUT; - p.appendJSString(c.val); + if (p === undefined) + // we assume not given + p = SC_DEFAULT_OUT; + p.appendJSString(c.val); } /* ------------------ write-circle ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_writeCircle(o, p) { - if (p === undefined) // we assume not given - p = SC_DEFAULT_OUT; - p.appendJSString(sc_toWriteCircleString(o)); + if (p === undefined) + // we assume not given + p = SC_DEFAULT_OUT; + p.appendJSString(sc_toWriteCircleString(o)); } function sc_toWriteCircleString(o) { - var symb = sc_gensym("writeCircle"); - var nbPointer = new Object(); - nbPointer.nb = 0; - sc_prepWriteCircle(o, symb, nbPointer); - return sc_genToWriteCircleString(o, symb); + var symb = sc_gensym("writeCircle"); + var nbPointer = new Object(); + nbPointer.nb = 0; + sc_prepWriteCircle(o, symb, nbPointer); + return sc_genToWriteCircleString(o, symb); } function sc_prepWriteCircle(o, symb, nbPointer) { - // TODO sc_Struct - if (o instanceof sc_Pair || - o instanceof sc_Vector) { - if (o[symb] !== undefined) { - // not the first visit. - o[symb]++; - // unless there is already a number, assign one. - if (!o[symb + "nb"]) o[symb + "nb"] = nbPointer.nb++; - return; - } - o[symb] = 0; - if (o instanceof sc_Pair) { - sc_prepWriteCircle(o.car, symb, nbPointer); - sc_prepWriteCircle(o.cdr, symb, nbPointer); - } else { - for (var i = 0; i < o.length; i++) - sc_prepWriteCircle(o[i], symb, nbPointer); - } + // TODO sc_Struct + if (o instanceof sc_Pair || o instanceof sc_Vector) { + if (o[symb] !== undefined) { + // not the first visit. + o[symb]++; + // unless there is already a number, assign one. + if (!o[symb + "nb"]) o[symb + "nb"] = nbPointer.nb++; + return; + } + o[symb] = 0; + if (o instanceof sc_Pair) { + sc_prepWriteCircle(o.car, symb, nbPointer); + sc_prepWriteCircle(o.cdr, symb, nbPointer); + } else { + for (var i = 0; i < o.length; i++) + sc_prepWriteCircle(o[i], symb, nbPointer); } + } } function sc_genToWriteCircleString(o, symb) { - if (!(o instanceof sc_Pair || - o instanceof sc_Vector)) - return sc_toWriteString(o); - return o.sc_toWriteCircleString(symb); -} -sc_Pair.prototype.sc_toWriteCircleString = function(symb, inList) { - if (this[symb + "use"]) { // use-flag is set. Just use it. - var nb = this[symb + "nb"]; - if (this[symb]-- === 0) { // if we are the last use. remove all fields. - delete this[symb]; - delete this[symb + "nb"]; - delete this[symb + "use"]; - } - if (inList) - return '. #' + nb + '#'; - else - return '#' + nb + '#'; - } - if (this[symb]-- === 0) { // if we are the last use. remove all fields. - delete this[symb]; - delete this[symb + "nb"]; - delete this[symb + "use"]; + if (!(o instanceof sc_Pair || o instanceof sc_Vector)) + return sc_toWriteString(o); + return o.sc_toWriteCircleString(symb); +} +sc_Pair.prototype.sc_toWriteCircleString = function (symb, inList) { + if (this[symb + "use"]) { + // use-flag is set. Just use it. + var nb = this[symb + "nb"]; + if (this[symb]-- === 0) { + // if we are the last use. remove all fields. + delete this[symb]; + delete this[symb + "nb"]; + delete this[symb + "use"]; } + if (inList) return ". #" + nb + "#"; + else return "#" + nb + "#"; + } + if (this[symb]-- === 0) { + // if we are the last use. remove all fields. + delete this[symb]; + delete this[symb + "nb"]; + delete this[symb + "use"]; + } - var res = ""; + var res = ""; - if (this[symb] !== undefined) { // implies > 0 - this[symb + "use"] = true; - if (inList) - res += '. #' + this[symb + "nb"] + '='; - else - res += '#' + this[symb + "nb"] + '='; - inList = false; - } + if (this[symb] !== undefined) { + // implies > 0 + this[symb + "use"] = true; + if (inList) res += ". #" + this[symb + "nb"] + "="; + else res += "#" + this[symb + "nb"] + "="; + inList = false; + } - if (!inList) - res += "("; + if (!inList) res += "("; - // print car - res += sc_genToWriteCircleString(this.car, symb); + // print car + res += sc_genToWriteCircleString(this.car, symb); - if (sc_isPair(this.cdr)) { - res += " " + this.cdr.sc_toWriteCircleString(symb, true); - } else if (this.cdr !== null) { - res += " . " + sc_genToWriteCircleString(this.cdr, symb); - } - if (!inList) - res += ")"; - return res; + if (sc_isPair(this.cdr)) { + res += " " + this.cdr.sc_toWriteCircleString(symb, true); + } else if (this.cdr !== null) { + res += " . " + sc_genToWriteCircleString(this.cdr, symb); + } + if (!inList) res += ")"; + return res; }; -sc_Vector.prototype.sc_toWriteCircleString = function(symb) { - if (this[symb + "use"]) { // use-flag is set. Just use it. - var nb = this[symb + "nb"]; - if (this[symb]-- === 0) { // if we are the last use. remove all fields. - delete this[symb]; - delete this[symb + "nb"]; - delete this[symb + "use"]; - } - return '#' + nb + '#'; - } - if (this[symb]-- === 0) { // if we are the last use. remove all fields. - delete this[symb]; - delete this[symb + "nb"]; - delete this[symb + "use"]; +sc_Vector.prototype.sc_toWriteCircleString = function (symb) { + if (this[symb + "use"]) { + // use-flag is set. Just use it. + var nb = this[symb + "nb"]; + if (this[symb]-- === 0) { + // if we are the last use. remove all fields. + delete this[symb]; + delete this[symb + "nb"]; + delete this[symb + "use"]; } + return "#" + nb + "#"; + } + if (this[symb]-- === 0) { + // if we are the last use. remove all fields. + delete this[symb]; + delete this[symb + "nb"]; + delete this[symb + "use"]; + } - var res = ""; - if (this[symb] !== undefined) { // implies > 0 - this[symb + "use"] = true; - res += '#' + this[symb + "nb"] + '='; - } - res += "#("; - for (var i = 0; i < this.length; i++) { - res += sc_genToWriteCircleString(this[i], symb); - if (i < this.length - 1) res += " "; - } - res += ")"; - return res; + var res = ""; + if (this[symb] !== undefined) { + // implies > 0 + this[symb + "use"] = true; + res += "#" + this[symb + "nb"] + "="; + } + res += "#("; + for (var i = 0; i < this.length; i++) { + res += sc_genToWriteCircleString(this[i], symb); + if (i < this.length - 1) res += " "; + } + res += ")"; + return res; }; - /* ------------------ print ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_print(s) { - if (arguments.length === 1) { - sc_display(s); - sc_newline(); - } - else { - for (var i = 0; i < arguments.length; i++) - sc_display(arguments[i]); - sc_newline(); - } + if (arguments.length === 1) { + sc_display(s); + sc_newline(); + } else { + for (var i = 0; i < arguments.length; i++) sc_display(arguments[i]); + sc_newline(); + } } /* ------------------ format ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_format(s, args) { - var len = s.length; - var p = new sc_StringOutputPort(); - var i = 0, j = 1; - - while( i < len ) { - var i2 = s.indexOf("~", i); - - if (i2 == -1) { - p.appendJSString( s.substring( i, len ) ); - return p.close(); - } else { - if (i2 > i) { - if (i2 == (len - 1)) { - p.appendJSString(s.substring(i, len)); - return p.close(); - } else { - p.appendJSString(s.substring(i, i2)); - i = i2; - } - } - - switch(s.charCodeAt(i2 + 1)) { - case 65: - case 97: - // a - sc_display(arguments[j], p); - i += 2; j++; - break; - - case 83: - case 115: - // s - sc_write(arguments[j], p); - i += 2; j++; - break; - - case 86: - case 118: - // v - sc_display(arguments[j], p); - p.appendJSString("\n"); - i += 2; j++; - break; - - case 67: - case 99: - // c - p.appendJSString(String.fromCharCode(arguments[j])); - i += 2; j++; - break; - - case 88: - case 120: - // x - p.appendJSString(arguments[j].toString(6)); - i += 2; j++; - break; - - case 79: - case 111: - // o - p.appendJSString(arguments[j].toString(8)); - i += 2; j++; - break; - - case 66: - case 98: - // b - p.appendJSString(arguments[j].toString(2)); - i += 2; j++; - break; - - case 37: - case 110: - // %, n - p.appendJSString("\n"); - i += 2; break; - - case 114: - // r - p.appendJSString("\r"); - i += 2; break; - - case 126: - // ~ - p.appendJSString("~"); - i += 2; break; - - default: - sc_error( "format: illegal ~" - + String.fromCharCode(s.charCodeAt(i2 + 1)) - + " sequence" ); - return ""; - } + var len = s.length; + var p = new sc_StringOutputPort(); + var i = 0, + j = 1; + + while (i < len) { + var i2 = s.indexOf("~", i); + + if (i2 == -1) { + p.appendJSString(s.substring(i, len)); + return p.close(); + } else { + if (i2 > i) { + if (i2 == len - 1) { + p.appendJSString(s.substring(i, len)); + return p.close(); + } else { + p.appendJSString(s.substring(i, i2)); + i = i2; + } } - } - return p.close(); + switch (s.charCodeAt(i2 + 1)) { + case 65: + case 97: + // a + sc_display(arguments[j], p); + i += 2; + j++; + break; + + case 83: + case 115: + // s + sc_write(arguments[j], p); + i += 2; + j++; + break; + + case 86: + case 118: + // v + sc_display(arguments[j], p); + p.appendJSString("\n"); + i += 2; + j++; + break; + + case 67: + case 99: + // c + p.appendJSString(String.fromCharCode(arguments[j])); + i += 2; + j++; + break; + + case 88: + case 120: + // x + p.appendJSString(arguments[j].toString(6)); + i += 2; + j++; + break; + + case 79: + case 111: + // o + p.appendJSString(arguments[j].toString(8)); + i += 2; + j++; + break; + + case 66: + case 98: + // b + p.appendJSString(arguments[j].toString(2)); + i += 2; + j++; + break; + + case 37: + case 110: + // %, n + p.appendJSString("\n"); + i += 2; + break; + + case 114: + // r + p.appendJSString("\r"); + i += 2; + break; + + case 126: + // ~ + p.appendJSString("~"); + i += 2; + break; + + default: + sc_error( + "format: illegal ~" + + String.fromCharCode(s.charCodeAt(i2 + 1)) + + " sequence" + ); + return ""; + } + } + } + + return p.close(); } /* ------------------ global ports ---------------------------------------------------*/ @@ -3113,78 +3170,75 @@ var sc_KEYWORD_PREFIX = "\u1E9D"; /*** META ((export #t) (peephole (id))) */ function sc_jsstring2string(s) { - return s; + return s; } /*** META ((export #t) (peephole (prefix "'\\u1E9C' +"))) */ function sc_jsstring2symbol(s) { - return sc_SYMBOL_PREFIX + s; + return sc_SYMBOL_PREFIX + s; } /*** META ((export #t) (peephole (id))) */ function sc_string2jsstring(s) { - return s; + return s; } /*** META ((export #t) (peephole (symbol2jsstring_immutable))) */ function sc_symbol2jsstring(s) { - return s.slice(1); + return s.slice(1); } /*** META ((export #t) (peephole (postfix ".slice(1)"))) */ function sc_keyword2jsstring(k) { - return k.slice(1); + return k.slice(1); } /*** META ((export #t) (peephole (prefix "'\\u1E9D' +"))) */ function sc_jsstring2keyword(s) { - return sc_KEYWORD_PREFIX + s; + return sc_KEYWORD_PREFIX + s; } /*** META ((export #t) (type bool)) */ function sc_isKeyword(s) { - return (typeof s === "string") && - (s.charAt(0) === sc_KEYWORD_PREFIX); + return typeof s === "string" && s.charAt(0) === sc_KEYWORD_PREFIX; } - /*** META ((export #t)) */ -var sc_gensym = function() { - var counter = 1000; - return function(sym) { - counter++; - if (!sym) sym = sc_SYMBOL_PREFIX; - return sym + "s" + counter + "~" + "^sC-GeNsYm "; - }; -}(); - +var sc_gensym = (function () { + var counter = 1000; + return function (sym) { + counter++; + if (!sym) sym = sc_SYMBOL_PREFIX; + return sym + "s" + counter + "~" + "^sC-GeNsYm "; + }; +})(); /*** META ((export #t) (type bool)) */ function sc_isEqual(o1, o2) { - return ((o1 === o2) || - (sc_isPair(o1) && sc_isPair(o2) - && sc_isPairEqual(o1, o2, sc_isEqual)) || - (sc_isVector(o1) && sc_isVector(o2) - && sc_isVectorEqual(o1, o2, sc_isEqual))); + return ( + o1 === o2 || + (sc_isPair(o1) && sc_isPair(o2) && sc_isPairEqual(o1, o2, sc_isEqual)) || + (sc_isVector(o1) && sc_isVector(o2) && sc_isVectorEqual(o1, o2, sc_isEqual)) + ); } /*** META ((export number->symbol integer->symbol)) */ function sc_number2symbol(x, radix) { - return sc_SYMBOL_PREFIX + sc_number2jsstring(x, radix); + return sc_SYMBOL_PREFIX + sc_number2jsstring(x, radix); } /*** META ((export number->string integer->string)) */ @@ -3192,7 +3246,7 @@ var sc_number2string = sc_number2jsstring; /*** META ((export #t)) */ function sc_symbol2number(s, radix) { - return sc_jsstring2number(s.slice(1), radix); + return sc_jsstring2number(s.slice(1), radix); } /*** META ((export #t)) */ @@ -3203,183 +3257,182 @@ var sc_string2number = sc_jsstring2number; ;; peephole will only apply if no radix is given. */ function sc_string2integer(s, radix) { - if (!radix) return +s; - return parseInt(s, radix); + if (!radix) return +s; + return parseInt(s, radix); } /*** META ((export #t) (peephole (prefix "+"))) */ function sc_string2real(s) { - return +s; + return +s; } - /*** META ((export #t) (type bool)) */ function sc_isSymbol(s) { - return (typeof s === "string") && - (s.charAt(0) === sc_SYMBOL_PREFIX); + return typeof s === "string" && s.charAt(0) === sc_SYMBOL_PREFIX; } /*** META ((export #t) (peephole (symbol2string_immutable))) */ function sc_symbol2string(s) { - return s.slice(1); + return s.slice(1); } /*** META ((export #t) (peephole (prefix "'\\u1E9C' +"))) */ function sc_string2symbol(s) { - return sc_SYMBOL_PREFIX + s; + return sc_SYMBOL_PREFIX + s; } /*** META ((export symbol-append) (peephole (symbolAppend_immutable))) */ function sc_symbolAppend() { - var res = sc_SYMBOL_PREFIX; - for (var i = 0; i < arguments.length; i++) - res += arguments[i].slice(1); - return res; + var res = sc_SYMBOL_PREFIX; + for (var i = 0; i < arguments.length; i++) res += arguments[i].slice(1); + return res; } /*** META ((export #t) (peephole (postfix ".val"))) */ -function sc_char2string(c) { return c.val; } +function sc_char2string(c) { + return c.val; +} /*** META ((export #t) (peephole (hole 1 "'\\u1E9C' + " c ".val"))) */ -function sc_char2symbol(c) { return sc_SYMBOL_PREFIX + c.val; } +function sc_char2symbol(c) { + return sc_SYMBOL_PREFIX + c.val; +} /*** META ((export #t) (type bool)) */ function sc_isString(s) { - return (typeof s === "string") && - (s.charAt(0) !== sc_SYMBOL_PREFIX); + return typeof s === "string" && s.charAt(0) !== sc_SYMBOL_PREFIX; } /*** META ((export #t)) */ var sc_makeString = sc_makejsString; - /*** META ((export #t)) */ function sc_string() { - for (var i = 0; i < arguments.length; i++) - arguments[i] = arguments[i].val; - return "".concat.apply("", arguments); + for (var i = 0; i < arguments.length; i++) arguments[i] = arguments[i].val; + return "".concat.apply("", arguments); } /*** META ((export #t) (peephole (postfix ".length"))) */ -function sc_stringLength(s) { return s.length; } +function sc_stringLength(s) { + return s.length; +} /*** META ((export #t)) */ function sc_stringRef(s, k) { - return new sc_Char(s.charAt(k)); + return new sc_Char(s.charAt(k)); } /* there's no stringSet in the immutable version function sc_stringSet(s, k, c) */ - /*** META ((export string=?) (type bool) (peephole (hole 2 str1 " === " str2))) */ function sc_isStringEqual(s1, s2) { - return s1 === s2; + return s1 === s2; } /*** META ((export string?) (type bool) (peephole (hole 2 str1 " > " str2))) */ function sc_isStringGreater(s1, s2) { - return s1 > s2; + return s1 > s2; } /*** META ((export string<=?) (type bool) (peephole (hole 2 str1 " <= " str2))) */ function sc_isStringLessEqual(s1, s2) { - return s1 <= s2; + return s1 <= s2; } /*** META ((export string>=?) (type bool) (peephole (hole 2 str1 " >= " str2))) */ function sc_isStringGreaterEqual(s1, s2) { - return s1 >= s2; + return s1 >= s2; } /*** META ((export string-ci=?) (type bool) (peephole (hole 2 str1 ".toLowerCase() === " str2 ".toLowerCase()"))) */ function sc_isStringCIEqual(s1, s2) { - return s1.toLowerCase() === s2.toLowerCase(); + return s1.toLowerCase() === s2.toLowerCase(); } /*** META ((export string-ci?) (type bool) (peephole (hole 2 str1 ".toLowerCase() > " str2 ".toLowerCase()"))) */ function sc_isStringCIGreater(s1, s2) { - return s1.toLowerCase() > s2.toLowerCase(); + return s1.toLowerCase() > s2.toLowerCase(); } /*** META ((export string-ci<=?) (type bool) (peephole (hole 2 str1 ".toLowerCase() <= " str2 ".toLowerCase()"))) */ function sc_isStringCILessEqual(s1, s2) { - return s1.toLowerCase() <= s2.toLowerCase(); + return s1.toLowerCase() <= s2.toLowerCase(); } /*** META ((export string-ci>=?) (type bool) (peephole (hole 2 str1 ".toLowerCase() >= " str2 ".toLowerCase()"))) */ function sc_isStringCIGreaterEqual(s1, s2) { - return s1.toLowerCase() >= s2.toLowerCase(); + return s1.toLowerCase() >= s2.toLowerCase(); } /*** META ((export #t) (peephole (hole 3 s ".substring(" start ", " end ")"))) */ function sc_substring(s, start, end) { - return s.substring(start, end); + return s.substring(start, end); } /*** META ((export #t)) -*/ + */ function sc_isSubstring_at(s1, s2, i) { - return s2 == s1.substring(i, i+ s2.length); + return s2 == s1.substring(i, i + s2.length); } /*** META ((export #t) (peephole (infix 0 #f "+" "''"))) */ function sc_stringAppend() { - return "".concat.apply("", arguments); + return "".concat.apply("", arguments); } /*** META ((export #t)) */ @@ -3392,7 +3445,7 @@ var sc_list2string = sc_list2jsstring; (peephole (id))) */ function sc_stringCopy(s) { - return s; + return s; } /* there's no string-fill in the immutable version @@ -3403,34 +3456,30 @@ function sc_stringFill(s, c) (peephole (postfix ".slice(1)"))) */ function sc_keyword2string(o) { - return o.slice(1); + return o.slice(1); } /*** META ((export #t) (peephole (prefix "'\\u1E9D' +"))) */ function sc_string2keyword(o) { - return sc_KEYWORD_PREFIX + o; + return sc_KEYWORD_PREFIX + o; } -String.prototype.sc_toDisplayString = function() { - if (this.charAt(0) === sc_SYMBOL_PREFIX) - // TODO: care for symbols with spaces (escape-chars symbols). - return this.slice(1); - else if (this.charAt(0) === sc_KEYWORD_PREFIX) - return ":" + this.slice(1); - else - return this.toString(); +String.prototype.sc_toDisplayString = function () { + if (this.charAt(0) === sc_SYMBOL_PREFIX) + // TODO: care for symbols with spaces (escape-chars symbols). + return this.slice(1); + else if (this.charAt(0) === sc_KEYWORD_PREFIX) return ":" + this.slice(1); + else return this.toString(); }; -String.prototype.sc_toWriteString = function() { - if (this.charAt(0) === sc_SYMBOL_PREFIX) - // TODO: care for symbols with spaces (escape-chars symbols). - return this.slice(1); - else if (this.charAt(0) === sc_KEYWORD_PREFIX) - return ":" + this.slice(1); - else - return '"' + sc_escapeWriteString(this) + '"'; +String.prototype.sc_toWriteString = function () { + if (this.charAt(0) === sc_SYMBOL_PREFIX) + // TODO: care for symbols with spaces (escape-chars symbols). + return this.slice(1); + else if (this.charAt(0) === sc_KEYWORD_PREFIX) return ":" + this.slice(1); + else return '"' + sc_escapeWriteString(this) + '"'; }; /* Exported Variables */ var BgL_testzd2boyerzd2; @@ -3462,341 +3511,4028 @@ var const_nboyer; var sc_const_3_nboyer; var sc_const_4_nboyer; { - (sc_const_4_nboyer = (new sc_Pair("\u1E9Cimplies",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cu",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cw",null)))))),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cw",null)))))),null))))))); - (sc_const_3_nboyer = sc_list((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccompile",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Ccodegen",(new sc_Pair((new sc_Pair("\u1E9Coptimize",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreaterp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clesseqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cboolean",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ciff",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceven1",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Codd",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccountps-",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccountps-loop",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfact-",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfact-loop",(new sc_Pair("\u1E9Ci",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdivides",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-true",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-false",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctautology-checker",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctautologyp",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfalsify",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfalsify1",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime1",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair("\u1E9Cp",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))))),(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cc",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cplus-fringe",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair("\u1E9Cenvrn",null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmc-flatten",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cintersect",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Ck",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ck",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Csort-lp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus1",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Ci",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cbase",null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cj",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cj",(new sc_Pair((1),null)))))),null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Ci",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cw",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cz",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnlistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csamefringe",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cz",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cw",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair(sc_list("\u1E9Cand", (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Ca",null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cb",null)))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cl",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cl",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdsort",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx1",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx2",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx3",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx4",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx5",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx6",(new sc_Pair("\u1E9Cx7",null)))))),null)))))),null)))))),null)))))),null)))))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((6),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx7",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cy",(new sc_Pair((2),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csigma",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Ci",null)))),null)))))),(new sc_Pair((2),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cz",null)))),null)))))),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Ca",null)))),null)))),(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Cb",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair("\u1E9Cz",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cassignedp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair((new sc_Pair("\u1E9Cset",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cval",(new sc_Pair("\u1E9Cmem",null)))))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair("\u1E9Cval",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cmem",null)))))),null)))))))),null)))))))); - (const_nboyer = (new sc_Pair((new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))))),null))))))))))); - BgL_nboyerzd2benchmarkzd2 = function() { - var args = null; - for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) { - args = sc_cons(arguments[sc_tmp], args); - } - var n; - return ((n = ((args === null)?(0):(args.car))), (BgL_setupzd2boyerzd2()), (BgL_runzd2benchmarkzd2(("nboyer"+(sc_number2string(n))), (1), function() { - return (BgL_testzd2boyerzd2(n)); - }, function(rewrites) { - if ((sc_isNumber(rewrites))) - switch (n) { - case (0): - return (rewrites===(95024)); - break; - case (1): - return (rewrites===(591777)); - break; - case (2): - return (rewrites===(1813975)); - break; - case (3): - return (rewrites===(5375678)); - break; - case (4): - return (rewrites===(16445406)); - break; - case (5): - return (rewrites===(51507739)); - break; - default: - return true; - break; - } - else - return false; - }))); - }; - BgL_setupzd2boyerzd2 = function() { - return true; - }; - BgL_testzd2boyerzd2 = function() { - return true; - }; - translate_term_nboyer = function(term) { - var lst; - return (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), ((lst = (term.cdr)), ((lst === null)?null:(new sc_Pair((translate_term_nboyer((lst.car))), (translate_args_nboyer((lst.cdr)))))))))); - }; - translate_args_nboyer = function(lst) { - var sc_lst_5; - var term; - return ((lst === null)?null:(new sc_Pair(((term = (lst.car)), (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr))))))), ((sc_lst_5 = (lst.cdr)), ((sc_lst_5 === null)?null:(new sc_Pair((translate_term_nboyer((sc_lst_5.car))), (translate_args_nboyer((sc_lst_5.cdr)))))))))); - }; - untranslate_term_nboyer = function(term) { - var optrOpnd; - var tail1131; - var L1127; - var falseHead1130; - var symbol_record; - if (!(term instanceof sc_Pair)) - return term; - else - { - (falseHead1130 = (new sc_Pair(null, null))); - (L1127 = (term.cdr)); - (tail1131 = falseHead1130); - while (!(L1127 === null)) { - { - (tail1131.cdr = (new sc_Pair((untranslate_term_nboyer((L1127.car))), null))); - (tail1131 = (tail1131.cdr)); - (L1127 = (L1127.cdr)); - } - } - (optrOpnd = (falseHead1130.cdr)); - return (new sc_Pair(((symbol_record = (term.car)), (symbol_record[(0)])), optrOpnd)); - } - }; - BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer = function(sym) { - var r; - var x; - return ((x = (sc_assq(sym, BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer))), ((x!== false)?(x.cdr):((r = [sym, null]), (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = (new sc_Pair((new sc_Pair(sym, r)), BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer))), r))); - }; - (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null); - translate_alist_nboyer = function(alist) { - var sc_alist_6; - var term; - return ((alist === null)?null:(new sc_Pair((new sc_Pair((alist.car.car), ((term = (alist.car.cdr)), (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr))))))))), ((sc_alist_6 = (alist.cdr)), ((sc_alist_6 === null)?null:(new sc_Pair((new sc_Pair((sc_alist_6.car.car), (translate_term_nboyer((sc_alist_6.car.cdr))))), (translate_alist_nboyer((sc_alist_6.cdr)))))))))); - }; - apply_subst_nboyer = function(alist, term) { - var lst; - var temp_temp; - return (!(term instanceof sc_Pair)?((temp_temp = (sc_assq(term, alist))), ((temp_temp!== false)?(temp_temp.cdr):term)):(new sc_Pair((term.car), ((lst = (term.cdr)), ((lst === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (lst.car))), (apply_subst_lst_nboyer(alist, (lst.cdr)))))))))); - }; - apply_subst_lst_nboyer = function(alist, lst) { - var sc_lst_7; - return ((lst === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (lst.car))), ((sc_lst_7 = (lst.cdr)), ((sc_lst_7 === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (sc_lst_7.car))), (apply_subst_lst_nboyer(alist, (sc_lst_7.cdr)))))))))); - }; - tautologyp_nboyer = function(sc_x_11, true_lst, false_lst) { - var tmp1125; - var x; - var tmp1126; - var sc_x_8; - var sc_tmp1125_9; - var sc_tmp1126_10; - var sc_x_11; - var true_lst; - var false_lst; - while (true) { - if ((((sc_tmp1126_10 = (is_term_equal_nboyer(sc_x_11, true_term_nboyer))), ((sc_tmp1126_10!== false)?sc_tmp1126_10:(is_term_member_nboyer(sc_x_11, true_lst))))!== false)) + sc_const_4_nboyer = new sc_Pair( + "\u1E9Cimplies", + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair( + "\u1E9Cimplies", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair( + "\u1E9Cimplies", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cz", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair( + "\u1E9Cimplies", + new sc_Pair("\u1E9Cz", new sc_Pair("\u1E9Cu", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cimplies", + new sc_Pair("\u1E9Cu", new sc_Pair("\u1E9Cw", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cimplies", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cw", null)) + ), + null + ) + ) + ); + sc_const_3_nboyer = sc_list( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Ccompile", new sc_Pair("\u1E9Cform", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Creverse", + new sc_Pair( + new sc_Pair( + "\u1E9Ccodegen", + new sc_Pair( + new sc_Pair( + "\u1E9Coptimize", + new sc_Pair("\u1E9Cform", null) + ), + new sc_Pair(new sc_Pair("\u1E9Cnil", null), null) + ) + ), + null + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Ceqp", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Cfix", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair("\u1E9Cfix", new sc_Pair("\u1E9Cy", null)), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cgreaterp", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cx", null)) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Clesseqp", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cx", null)) + ), + null + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cgreatereqp", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Cboolean", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cor", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + "\u1E9Cx", + new sc_Pair(new sc_Pair("\u1E9Ct", null), null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + "\u1E9Cx", + new sc_Pair(new sc_Pair("\u1E9Cf", null), null) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Ciff", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair( + "\u1E9Cimplies", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cimplies", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cx", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Ceven1", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair("\u1E9Ct", null), + new sc_Pair( + new sc_Pair( + "\u1E9Codd", + new sc_Pair( + new sc_Pair("\u1E9Csub1", new sc_Pair("\u1E9Cx", null)), + null + ) + ), + null + ) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Ccountps-", + new sc_Pair("\u1E9Cl", new sc_Pair("\u1E9Cpred", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Ccountps-loop", + new sc_Pair( + "\u1E9Cl", + new sc_Pair( + "\u1E9Cpred", + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Cfact-", new sc_Pair("\u1E9Ci", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cfact-loop", + new sc_Pair("\u1E9Ci", new sc_Pair(1, null)) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Creverse-", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Creverse-loop", + new sc_Pair( + "\u1E9Cx", + new sc_Pair(new sc_Pair("\u1E9Cnil", null), null) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cdivides", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Czerop", + new sc_Pair( + new sc_Pair( + "\u1E9Cremainder", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cx", null)) + ), + null + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cassume-true", + new sc_Pair("\u1E9Cvar", new sc_Pair("\u1E9Calist", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Ccons", + new sc_Pair( + new sc_Pair( + "\u1E9Ccons", + new sc_Pair( + "\u1E9Cvar", + new sc_Pair(new sc_Pair("\u1E9Ct", null), null) + ) + ), + new sc_Pair("\u1E9Calist", null) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cassume-false", + new sc_Pair("\u1E9Cvar", new sc_Pair("\u1E9Calist", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Ccons", + new sc_Pair( + new sc_Pair( + "\u1E9Ccons", + new sc_Pair( + "\u1E9Cvar", + new sc_Pair(new sc_Pair("\u1E9Cf", null), null) + ) + ), + new sc_Pair("\u1E9Calist", null) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Ctautology-checker", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Ctautologyp", + new sc_Pair( + new sc_Pair("\u1E9Cnormalize", new sc_Pair("\u1E9Cx", null)), + new sc_Pair(new sc_Pair("\u1E9Cnil", null), null) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Cfalsify", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cfalsify1", + new sc_Pair( + new sc_Pair("\u1E9Cnormalize", new sc_Pair("\u1E9Cx", null)), + new sc_Pair(new sc_Pair("\u1E9Cnil", null), null) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Cprime", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cx", null)), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair( + "\u1E9Cadd1", + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ), + null + ) + ) + ), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cprime1", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair("\u1E9Csub1", new sc_Pair("\u1E9Cx", null)), + null + ) + ) + ), + null + ) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair("\u1E9Cp", new sc_Pair("\u1E9Cq", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + "\u1E9Cp", + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + "\u1E9Cq", + new sc_Pair( + new sc_Pair("\u1E9Ct", null), + new sc_Pair(new sc_Pair("\u1E9Cf", null), null) + ) + ) + ), + new sc_Pair(new sc_Pair("\u1E9Cf", null), null) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cor", + new sc_Pair("\u1E9Cp", new sc_Pair("\u1E9Cq", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + "\u1E9Cp", + new sc_Pair( + new sc_Pair("\u1E9Ct", null), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + "\u1E9Cq", + new sc_Pair( + new sc_Pair("\u1E9Ct", null), + new sc_Pair(new sc_Pair("\u1E9Cf", null), null) + ) + ) + ), + null + ) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Cnot", new sc_Pair("\u1E9Cp", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + "\u1E9Cp", + new sc_Pair( + new sc_Pair("\u1E9Cf", null), + new sc_Pair(new sc_Pair("\u1E9Ct", null), null) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cimplies", + new sc_Pair("\u1E9Cp", new sc_Pair("\u1E9Cq", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + "\u1E9Cp", + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + "\u1E9Cq", + new sc_Pair( + new sc_Pair("\u1E9Ct", null), + new sc_Pair(new sc_Pair("\u1E9Cf", null), null) + ) + ) + ), + new sc_Pair(new sc_Pair("\u1E9Ct", null), null) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Cfix", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair("\u1E9Cnumberp", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + "\u1E9Cx", + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + "\u1E9Ca", + new sc_Pair("\u1E9Cb", new sc_Pair("\u1E9Cc", null)) + ) + ), + new sc_Pair("\u1E9Cd", new sc_Pair("\u1E9Ce", null)) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + "\u1E9Ca", + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + "\u1E9Cb", + new sc_Pair("\u1E9Cd", new sc_Pair("\u1E9Ce", null)) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + "\u1E9Cc", + new sc_Pair("\u1E9Cd", new sc_Pair("\u1E9Ce", null)) + ) + ), + null + ) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cor", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + "\u1E9Cx", + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair("\u1E9Cnumberp", new sc_Pair("\u1E9Cx", null)), + null + ) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair("\u1E9Cz", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cz", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Ca", null)), + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cb", null)), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cx", null)) + ), + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cc", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Cfix", new sc_Pair("\u1E9Cb", null)), + new sc_Pair( + new sc_Pair("\u1E9Cfix", new sc_Pair("\u1E9Cc", null)), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Czero", null), + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cx", null)) + ), + null + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair("\u1E9Cnumberp", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cor", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + "\u1E9Cx", + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cy", null)), + null + ) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cmeaning", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus-tree", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ), + new sc_Pair("\u1E9Ca", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + new sc_Pair( + "\u1E9Cmeaning", + new sc_Pair( + new sc_Pair("\u1E9Cplus-tree", new sc_Pair("\u1E9Cx", null)), + new sc_Pair("\u1E9Ca", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cmeaning", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus-tree", + new sc_Pair("\u1E9Cy", null) + ), + new sc_Pair("\u1E9Ca", null) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cmeaning", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus-tree", + new sc_Pair( + new sc_Pair("\u1E9Cplus-fringe", new sc_Pair("\u1E9Cx", null)), + null + ) + ), + new sc_Pair("\u1E9Ca", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cfix", + new sc_Pair( + new sc_Pair( + "\u1E9Cmeaning", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Ca", null)) + ), + null + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair("\u1E9Cz", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cz", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Creverse", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair( + new sc_Pair("\u1E9Creverse", new sc_Pair("\u1E9Cb", null)), + new sc_Pair( + new sc_Pair("\u1E9Creverse", new sc_Pair("\u1E9Ca", null)), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cz", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cz", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair("\u1E9Cz", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cz", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cor", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cy", null)), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cexec", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair("\u1E9Cpds", new sc_Pair("\u1E9Cenvrn", null)) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cexec", + new sc_Pair( + "\u1E9Cy", + new sc_Pair( + new sc_Pair( + "\u1E9Cexec", + new sc_Pair( + "\u1E9Cx", + new sc_Pair("\u1E9Cpds", new sc_Pair("\u1E9Cenvrn", null)) + ) + ), + new sc_Pair("\u1E9Cenvrn", null) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cmc-flatten", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair( + new sc_Pair("\u1E9Cflatten", new sc_Pair("\u1E9Cx", null)), + new sc_Pair("\u1E9Cy", null) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cmember", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cor", + new sc_Pair( + new sc_Pair( + "\u1E9Cmember", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Ca", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cmember", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cb", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cmember", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair("\u1E9Creverse", new sc_Pair("\u1E9Cy", null)), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cmember", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Clength", + new sc_Pair( + new sc_Pair("\u1E9Creverse", new sc_Pair("\u1E9Cx", null)), + null + ) + ), + new sc_Pair( + new sc_Pair("\u1E9Clength", new sc_Pair("\u1E9Cx", null)), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cmember", + new sc_Pair( + "\u1E9Ca", + new sc_Pair( + new sc_Pair( + "\u1E9Cintersect", + new sc_Pair("\u1E9Cb", new sc_Pair("\u1E9Cc", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair( + "\u1E9Cmember", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cmember", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cc", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cnth", + new sc_Pair( + new sc_Pair("\u1E9Czero", null), + new sc_Pair("\u1E9Ci", null) + ) + ), + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cexp", + new sc_Pair( + "\u1E9Ci", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cj", new sc_Pair("\u1E9Ck", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair( + new sc_Pair( + "\u1E9Cexp", + new sc_Pair("\u1E9Ci", new sc_Pair("\u1E9Cj", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cexp", + new sc_Pair("\u1E9Ci", new sc_Pair("\u1E9Ck", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cexp", + new sc_Pair( + "\u1E9Ci", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cj", new sc_Pair("\u1E9Ck", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cexp", + new sc_Pair( + new sc_Pair( + "\u1E9Cexp", + new sc_Pair("\u1E9Ci", new sc_Pair("\u1E9Cj", null)) + ), + new sc_Pair("\u1E9Ck", null) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Creverse-loop", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair( + new sc_Pair("\u1E9Creverse", new sc_Pair("\u1E9Cx", null)), + new sc_Pair("\u1E9Cy", null) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Creverse-loop", + new sc_Pair( + "\u1E9Cx", + new sc_Pair(new sc_Pair("\u1E9Cnil", null), null) + ) + ), + new sc_Pair( + new sc_Pair("\u1E9Creverse", new sc_Pair("\u1E9Cx", null)), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Ccount-list", + new sc_Pair( + "\u1E9Cz", + new sc_Pair( + new sc_Pair( + "\u1E9Csort-lp", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + new sc_Pair( + "\u1E9Ccount-list", + new sc_Pair("\u1E9Cz", new sc_Pair("\u1E9Cx", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Ccount-list", + new sc_Pair("\u1E9Cz", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cc", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair("\u1E9Cb", new sc_Pair("\u1E9Cc", null)) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + new sc_Pair( + "\u1E9Cremainder", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair( + "\u1E9Cy", + new sc_Pair( + new sc_Pair( + "\u1E9Cquotient", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair("\u1E9Cfix", new sc_Pair("\u1E9Cx", null)), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cpower-eval", + new sc_Pair( + new sc_Pair( + "\u1E9Cbig-plus1", + new sc_Pair( + "\u1E9Cl", + new sc_Pair("\u1E9Ci", new sc_Pair("\u1E9Cbase", null)) + ) + ), + new sc_Pair("\u1E9Cbase", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + new sc_Pair( + "\u1E9Cpower-eval", + new sc_Pair("\u1E9Cl", new sc_Pair("\u1E9Cbase", null)) + ), + new sc_Pair("\u1E9Ci", null) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cpower-eval", + new sc_Pair( + new sc_Pair( + "\u1E9Cbig-plus", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + "\u1E9Cy", + new sc_Pair("\u1E9Ci", new sc_Pair("\u1E9Cbase", null)) + ) + ) + ), + new sc_Pair("\u1E9Cbase", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + "\u1E9Ci", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + new sc_Pair( + "\u1E9Cpower-eval", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cbase", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cpower-eval", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cbase", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cremainder", + new sc_Pair("\u1E9Cy", new sc_Pair(1, null)) + ), + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair( + new sc_Pair( + "\u1E9Cremainder", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair("\u1E9Cy", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cy", null)), + null + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cremainder", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cx", null)) + ), + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair( + new sc_Pair( + "\u1E9Cquotient", + new sc_Pair("\u1E9Ci", new sc_Pair("\u1E9Cj", null)) + ), + new sc_Pair("\u1E9Ci", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Ci", null)), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cor", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cj", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair("\u1E9Cj", new sc_Pair(1, null)) + ), + null + ) + ), + null + ) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair( + new sc_Pair( + "\u1E9Cremainder", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair("\u1E9Cx", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cy", null)), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cx", null)), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ), + null + ) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cpower-eval", + new sc_Pair( + new sc_Pair( + "\u1E9Cpower-rep", + new sc_Pair("\u1E9Ci", new sc_Pair("\u1E9Cbase", null)) + ), + new sc_Pair("\u1E9Cbase", null) + ) + ), + new sc_Pair( + new sc_Pair("\u1E9Cfix", new sc_Pair("\u1E9Ci", null)), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cpower-eval", + new sc_Pair( + new sc_Pair( + "\u1E9Cbig-plus", + new sc_Pair( + new sc_Pair( + "\u1E9Cpower-rep", + new sc_Pair("\u1E9Ci", new sc_Pair("\u1E9Cbase", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cpower-rep", + new sc_Pair("\u1E9Cj", new sc_Pair("\u1E9Cbase", null)) + ), + new sc_Pair( + new sc_Pair("\u1E9Czero", null), + new sc_Pair("\u1E9Cbase", null) + ) + ) + ) + ), + new sc_Pair("\u1E9Cbase", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Ci", new sc_Pair("\u1E9Cj", null)) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cgcd", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cgcd", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cx", null)) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cnth", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + new sc_Pair("\u1E9Ci", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair( + new sc_Pair( + "\u1E9Cnth", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Ci", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnth", + new sc_Pair( + "\u1E9Cb", + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair( + "\u1E9Ci", + new sc_Pair( + new sc_Pair( + "\u1E9Clength", + new sc_Pair("\u1E9Ca", null) + ), + null + ) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair("\u1E9Cx", null) + ) + ), + new sc_Pair( + new sc_Pair("\u1E9Cfix", new sc_Pair("\u1E9Cy", null)), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cx", null)) + ), + new sc_Pair("\u1E9Cx", null) + ) + ), + new sc_Pair( + new sc_Pair("\u1E9Cfix", new sc_Pair("\u1E9Cy", null)), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cz", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cz", null)) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair("\u1E9Cc", new sc_Pair("\u1E9Cw", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cc", new sc_Pair("\u1E9Cx", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cw", new sc_Pair("\u1E9Cx", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cremainder", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cz", null)) + ), + new sc_Pair("\u1E9Cz", null) + ) + ), + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + "\u1E9Cb", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cc", null)) + ), + null + ) + ) + ), + new sc_Pair("\u1E9Ca", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cb", new sc_Pair("\u1E9Cc", null)) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair( + new sc_Pair( + "\u1E9Cadd1", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cz", null)) + ), + null + ) + ), + new sc_Pair("\u1E9Cz", null) + ) + ), + new sc_Pair( + new sc_Pair("\u1E9Cadd1", new sc_Pair("\u1E9Cy", null)), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cz", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cz", null)) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cz", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cz", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cz", null)), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair( + "\u1E9Cy", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cx", null)), + null + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cgcd", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cz", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cz", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair( + "\u1E9Cz", + new sc_Pair( + new sc_Pair( + "\u1E9Cgcd", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cvalue", + new sc_Pair( + new sc_Pair("\u1E9Cnormalize", new sc_Pair("\u1E9Cx", null)), + new sc_Pair("\u1E9Ca", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cvalue", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Ca", null)) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Cflatten", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Ccons", + new sc_Pair( + "\u1E9Cy", + new sc_Pair(new sc_Pair("\u1E9Cnil", null), null) + ) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair("\u1E9Cnlistp", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Clistp", + new sc_Pair( + new sc_Pair("\u1E9Cgopher", new sc_Pair("\u1E9Cx", null)), + null + ) + ), + new sc_Pair( + new sc_Pair("\u1E9Clistp", new sc_Pair("\u1E9Cx", null)), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Csamefringe", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Cflatten", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair("\u1E9Cflatten", new sc_Pair("\u1E9Cy", null)), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cgreatest-factor", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair( + "\u1E9Cor", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cy", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair("\u1E9Cy", new sc_Pair(1, null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + "\u1E9Cx", + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cgreatest-factor", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair(1, null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair("\u1E9Cx", new sc_Pair(1, null)) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cnumberp", + new sc_Pair( + new sc_Pair( + "\u1E9Cgreatest-factor", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair( + "\u1E9Cor", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cy", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair("\u1E9Cy", new sc_Pair(1, null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair( + "\u1E9Cnumberp", + new sc_Pair("\u1E9Cx", null) + ), + null + ) + ), + null + ) + ) + ), + null + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes-list", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair( + new sc_Pair("\u1E9Ctimes-list", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair("\u1E9Ctimes-list", new sc_Pair("\u1E9Cy", null)), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cprime-list", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair("\u1E9Cprime-list", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair("\u1E9Cprime-list", new sc_Pair("\u1E9Cy", null)), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + "\u1E9Cz", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cw", new sc_Pair("\u1E9Cz", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair("\u1E9Cnumberp", new sc_Pair("\u1E9Cz", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cor", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + "\u1E9Cz", + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair("\u1E9Cw", new sc_Pair(1, null)) + ), + null + ) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cgreatereqp", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cor", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + "\u1E9Cx", + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cand", + new sc_Pair( + new sc_Pair("\u1E9Cnumberp", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair("\u1E9Cy", new sc_Pair(1, null)) + ), + null + ) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cremainder", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cx", null)) + ), + new sc_Pair("\u1E9Cy", null) + ) + ), + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + new sc_Pair(1, null) + ) + ), + new sc_Pair( + sc_list( + "\u1E9Cand", + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + "\u1E9Ca", + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + null + ) + ), + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + "\u1E9Cb", + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + null + ) + ), + new sc_Pair("\u1E9Cnumberp", new sc_Pair("\u1E9Ca", null)), + new sc_Pair("\u1E9Cnumberp", new sc_Pair("\u1E9Cb", null)), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Csub1", new sc_Pair("\u1E9Ca", null)), + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Csub1", new sc_Pair("\u1E9Cb", null)), + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair( + new sc_Pair( + "\u1E9Clength", + new sc_Pair( + new sc_Pair( + "\u1E9Cdelete", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cl", null)) + ), + null + ) + ), + new sc_Pair( + new sc_Pair("\u1E9Clength", new sc_Pair("\u1E9Cl", null)), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cmember", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cl", null)) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Csort2", + new sc_Pair( + new sc_Pair( + "\u1E9Cdelete", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cl", null)) + ), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cdelete", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair("\u1E9Csort2", new sc_Pair("\u1E9Cl", null)), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Cdsort", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair("\u1E9Csort2", new sc_Pair("\u1E9Cx", null)), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Clength", + new sc_Pair( + new sc_Pair( + "\u1E9Ccons", + new sc_Pair( + "\u1E9Cx1", + new sc_Pair( + new sc_Pair( + "\u1E9Ccons", + new sc_Pair( + "\u1E9Cx2", + new sc_Pair( + new sc_Pair( + "\u1E9Ccons", + new sc_Pair( + "\u1E9Cx3", + new sc_Pair( + new sc_Pair( + "\u1E9Ccons", + new sc_Pair( + "\u1E9Cx4", + new sc_Pair( + new sc_Pair( + "\u1E9Ccons", + new sc_Pair( + "\u1E9Cx5", + new sc_Pair( + new sc_Pair( + "\u1E9Ccons", + new sc_Pair( + "\u1E9Cx6", + new sc_Pair("\u1E9Cx7", null) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + 6, + new sc_Pair( + new sc_Pair("\u1E9Clength", new sc_Pair("\u1E9Cx7", null)), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair( + new sc_Pair( + "\u1E9Cadd1", + new sc_Pair( + new sc_Pair("\u1E9Cadd1", new sc_Pair("\u1E9Cx", null)), + null + ) + ), + new sc_Pair(2, null) + ) + ), + new sc_Pair( + new sc_Pair("\u1E9Cfix", new sc_Pair("\u1E9Cx", null)), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cquotient", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ), + new sc_Pair(2, null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair( + "\u1E9Cquotient", + new sc_Pair("\u1E9Cy", new sc_Pair(2, null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Csigma", + new sc_Pair( + new sc_Pair("\u1E9Czero", null), + new sc_Pair("\u1E9Ci", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cquotient", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair( + "\u1E9Ci", + new sc_Pair( + new sc_Pair("\u1E9Cadd1", new sc_Pair("\u1E9Ci", null)), + null + ) + ) + ), + new sc_Pair(2, null) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair("\u1E9Cadd1", new sc_Pair("\u1E9Cy", null)), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair("\u1E9Cnumberp", new sc_Pair("\u1E9Cy", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cadd1", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ), + new sc_Pair( + new sc_Pair("\u1E9Cadd1", new sc_Pair("\u1E9Cx", null)), + null + ) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair("\u1E9Cz", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cz", null)) + ), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair("\u1E9Cz", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cnot", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair( + "\u1E9Cy", + new sc_Pair("\u1E9Cx", null) + ) + ), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cfix", + new sc_Pair("\u1E9Cx", null) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cfix", + new sc_Pair("\u1E9Cz", null) + ), + null + ) + ) + ), + null + ) + ) + ) + ), + null + ) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cmeaning", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus-tree", + new sc_Pair( + new sc_Pair( + "\u1E9Cdelete", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ), + new sc_Pair("\u1E9Ca", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair( + "\u1E9Cmember", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair( + new sc_Pair( + "\u1E9Cmeaning", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus-tree", + new sc_Pair("\u1E9Cy", null) + ), + new sc_Pair("\u1E9Ca", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cmeaning", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Ca", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cmeaning", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus-tree", + new sc_Pair("\u1E9Cy", null) + ), + new sc_Pair("\u1E9Ca", null) + ) + ), + null + ) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair("\u1E9Cadd1", new sc_Pair("\u1E9Cy", null)), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair("\u1E9Cnumberp", new sc_Pair("\u1E9Cy", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair("\u1E9Cfix", new sc_Pair("\u1E9Cx", null)), + null + ) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cnth", + new sc_Pair( + new sc_Pair("\u1E9Cnil", null), + new sc_Pair("\u1E9Ci", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Ci", null)), + new sc_Pair( + new sc_Pair("\u1E9Cnil", null), + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Clast", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair("\u1E9Clistp", new sc_Pair("\u1E9Cb", null)), + new sc_Pair( + new sc_Pair("\u1E9Clast", new sc_Pair("\u1E9Cb", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair("\u1E9Clistp", new sc_Pair("\u1E9Ca", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Ccons", + new sc_Pair( + new sc_Pair( + "\u1E9Ccar", + new sc_Pair( + new sc_Pair( + "\u1E9Clast", + new sc_Pair("\u1E9Ca", null) + ), + null + ) + ), + new sc_Pair("\u1E9Cb", null) + ) + ), + new sc_Pair("\u1E9Cb", null) + ) + ) + ), + null + ) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair("\u1E9Cz", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair( + "\u1E9Clessp", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Ct", null), + new sc_Pair("\u1E9Cz", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair("\u1E9Cf", null), + new sc_Pair("\u1E9Cz", null) + ) + ), + null + ) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cassignment", + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair( + "\u1E9Cassignedp", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Ca", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cassignment", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Ca", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cassignment", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cb", null)) + ), + null + ) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Ccar", + new sc_Pair( + new sc_Pair("\u1E9Cgopher", new sc_Pair("\u1E9Cx", null)), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair("\u1E9Clistp", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Ccar", + new sc_Pair( + new sc_Pair("\u1E9Cflatten", new sc_Pair("\u1E9Cx", null)), + null + ) + ), + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cflatten", + new sc_Pair( + new sc_Pair( + "\u1E9Ccdr", + new sc_Pair( + new sc_Pair("\u1E9Cgopher", new sc_Pair("\u1E9Cx", null)), + null + ) + ), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair("\u1E9Clistp", new sc_Pair("\u1E9Cx", null)), + new sc_Pair( + new sc_Pair( + "\u1E9Ccdr", + new sc_Pair( + new sc_Pair("\u1E9Cflatten", new sc_Pair("\u1E9Cx", null)), + null + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Ccons", + new sc_Pair( + new sc_Pair("\u1E9Czero", null), + new sc_Pair(new sc_Pair("\u1E9Cnil", null), null) + ) + ), + null + ) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cquotient", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Cy", new sc_Pair("\u1E9Cx", null)) + ), + new sc_Pair("\u1E9Cy", null) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair("\u1E9Czerop", new sc_Pair("\u1E9Cy", null)), + new sc_Pair( + new sc_Pair("\u1E9Czero", null), + new sc_Pair( + new sc_Pair("\u1E9Cfix", new sc_Pair("\u1E9Cx", null)), + null + ) + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cget", + new sc_Pair( + "\u1E9Cj", + new sc_Pair( + new sc_Pair( + "\u1E9Cset", + new sc_Pair( + "\u1E9Ci", + new sc_Pair("\u1E9Cval", new sc_Pair("\u1E9Cmem", null)) + ) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cif", + new sc_Pair( + new sc_Pair( + "\u1E9Ceqp", + new sc_Pair("\u1E9Cj", new sc_Pair("\u1E9Ci", null)) + ), + new sc_Pair( + "\u1E9Cval", + new sc_Pair( + new sc_Pair( + "\u1E9Cget", + new sc_Pair("\u1E9Cj", new sc_Pair("\u1E9Cmem", null)) + ), + null + ) + ) + ) + ), + null + ) + ) + ) + ); + const_nboyer = new sc_Pair( + new sc_Pair( + "\u1E9Cx", + new sc_Pair( + "\u1E9Cf", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair( + "\u1E9Cc", + new sc_Pair(new sc_Pair("\u1E9Czero", null), null) + ) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cy", + new sc_Pair( + "\u1E9Cf", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair( + new sc_Pair( + "\u1E9Ctimes", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Cc", new sc_Pair("\u1E9Cd", null)) + ), + null + ) + ) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cz", + new sc_Pair( + "\u1E9Cf", + new sc_Pair( + new sc_Pair( + "\u1E9Creverse", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair( + new sc_Pair( + "\u1E9Cappend", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + new sc_Pair(new sc_Pair("\u1E9Cnil", null), null) + ) + ), + null + ) + ), + null + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cu", + new sc_Pair( + "\u1E9Cequal", + new sc_Pair( + new sc_Pair( + "\u1E9Cplus", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cdifference", + new sc_Pair("\u1E9Cx", new sc_Pair("\u1E9Cy", null)) + ), + null + ) + ) + ) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cw", + new sc_Pair( + "\u1E9Clessp", + new sc_Pair( + new sc_Pair( + "\u1E9Cremainder", + new sc_Pair("\u1E9Ca", new sc_Pair("\u1E9Cb", null)) + ), + new sc_Pair( + new sc_Pair( + "\u1E9Cmember", + new sc_Pair( + "\u1E9Ca", + new sc_Pair( + new sc_Pair( + "\u1E9Clength", + new sc_Pair("\u1E9Cb", null) + ), + null + ) + ) + ), + null + ) + ) + ) + ), + null + ) + ) + ) + ) + ); + BgL_nboyerzd2benchmarkzd2 = function () { + var args = null; + for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) { + args = sc_cons(arguments[sc_tmp], args); + } + var n; + return ( + (n = args === null ? 0 : args.car), + BgL_setupzd2boyerzd2(), + BgL_runzd2benchmarkzd2( + "nboyer" + sc_number2string(n), + 1, + function () { + return BgL_testzd2boyerzd2(n); + }, + function (rewrites) { + if (sc_isNumber(rewrites)) + switch (n) { + case 0: + return rewrites === 95024; + break; + case 1: + return rewrites === 591777; + break; + case 2: + return rewrites === 1813975; + break; + case 3: + return rewrites === 5375678; + break; + case 4: + return rewrites === 16445406; + break; + case 5: + return rewrites === 51507739; + break; + default: return true; - else - if ((((sc_tmp1125_9 = (is_term_equal_nboyer(sc_x_11, false_term_nboyer))), ((sc_tmp1125_9!== false)?sc_tmp1125_9:(is_term_member_nboyer(sc_x_11, false_lst))))!== false)) - return false; - else - if (!(sc_x_11 instanceof sc_Pair)) - return false; - else - if (((sc_x_11.car)===if_constructor_nboyer)) - if ((((sc_x_8 = (sc_x_11.cdr.car)), (tmp1126 = (is_term_equal_nboyer(sc_x_8, true_term_nboyer))), ((tmp1126!== false)?tmp1126:(is_term_member_nboyer(sc_x_8, true_lst))))!== false)) - (sc_x_11 = (sc_x_11.cdr.cdr.car)); - else - if ((((x = (sc_x_11.cdr.car)), (tmp1125 = (is_term_equal_nboyer(x, false_term_nboyer))), ((tmp1125!== false)?tmp1125:(is_term_member_nboyer(x, false_lst))))!== false)) - (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car)); - else - if (((tautologyp_nboyer((sc_x_11.cdr.cdr.car), (new sc_Pair((sc_x_11.cdr.car), true_lst)), false_lst))!== false)) - { - (false_lst = (new sc_Pair((sc_x_11.cdr.car), false_lst))); - (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car)); - } - else - return false; - else - return false; + break; + } + else return false; } - }; - (if_constructor_nboyer = "\u1E9C*"); - (rewrite_count_nboyer = (0)); - rewrite_nboyer = function(term) { - var term2; - var sc_term_12; - var lst; - var symbol_record; - var sc_lst_13; + ) + ); + }; + BgL_setupzd2boyerzd2 = function () { + return true; + }; + BgL_testzd2boyerzd2 = function () { + return true; + }; + translate_term_nboyer = function (term) { + var lst; + return !(term instanceof sc_Pair) + ? term + : new sc_Pair( + BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(term.car), + ((lst = term.cdr), + lst === null + ? null + : new sc_Pair( + translate_term_nboyer(lst.car), + translate_args_nboyer(lst.cdr) + )) + ); + }; + translate_args_nboyer = function (lst) { + var sc_lst_5; + var term; + return lst === null + ? null + : new sc_Pair( + ((term = lst.car), + !(term instanceof sc_Pair) + ? term + : new sc_Pair( + BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(term.car), + translate_args_nboyer(term.cdr) + )), + ((sc_lst_5 = lst.cdr), + sc_lst_5 === null + ? null + : new sc_Pair( + translate_term_nboyer(sc_lst_5.car), + translate_args_nboyer(sc_lst_5.cdr) + )) + ); + }; + untranslate_term_nboyer = function (term) { + var optrOpnd; + var tail1131; + var L1127; + var falseHead1130; + var symbol_record; + if (!(term instanceof sc_Pair)) return term; + else { + falseHead1130 = new sc_Pair(null, null); + L1127 = term.cdr; + tail1131 = falseHead1130; + while (!(L1127 === null)) { { - (++rewrite_count_nboyer); - if (!(term instanceof sc_Pair)) - return term; - else - { - (sc_term_12 = (new sc_Pair((term.car), ((sc_lst_13 = (term.cdr)), ((sc_lst_13 === null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_13.car))), (rewrite_args_nboyer((sc_lst_13.cdr)))))))))); - (lst = ((symbol_record = (term.car)), (symbol_record[(1)]))); - while (true) { - if ((lst === null)) - return sc_term_12; - else - if ((((term2 = ((lst.car).cdr.car)), (unify_subst_nboyer = null), (one_way_unify1_nboyer(sc_term_12, term2)))!== false)) - return (rewrite_nboyer((apply_subst_nboyer(unify_subst_nboyer, ((lst.car).cdr.cdr.car))))); - else - (lst = (lst.cdr)); - } - } + tail1131.cdr = new sc_Pair(untranslate_term_nboyer(L1127.car), null); + tail1131 = tail1131.cdr; + L1127 = L1127.cdr; } - }; - rewrite_args_nboyer = function(lst) { - var sc_lst_14; - return ((lst === null)?null:(new sc_Pair((rewrite_nboyer((lst.car))), ((sc_lst_14 = (lst.cdr)), ((sc_lst_14 === null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_14.car))), (rewrite_args_nboyer((sc_lst_14.cdr)))))))))); - }; - (unify_subst_nboyer = "\u1E9C*"); - one_way_unify1_nboyer = function(term1, term2) { - var lst1; - var lst2; - var temp_temp; - if (!(term2 instanceof sc_Pair)) - { - (temp_temp = (sc_assq(term2, unify_subst_nboyer))); - if ((temp_temp!== false)) - return (is_term_equal_nboyer(term1, (temp_temp.cdr))); - else - if ((sc_isNumber(term2))) - return (sc_isEqual(term1, term2)); - else - { - (unify_subst_nboyer = (new sc_Pair((new sc_Pair(term2, term1)), unify_subst_nboyer))); - return true; - } - } - else - if (!(term1 instanceof sc_Pair)) - return false; - else - if (((term1.car)===(term2.car))) - { - (lst1 = (term1.cdr)); - (lst2 = (term2.cdr)); - while (true) { - if ((lst1 === null)) - return (lst2 === null); - else - if ((lst2 === null)) - return false; - else - if (((one_way_unify1_nboyer((lst1.car), (lst2.car)))!== false)) - { - (lst1 = (lst1.cdr)); - (lst2 = (lst2.cdr)); - } - else - return false; - } - } - else - return false; - }; - (false_term_nboyer = "\u1E9C*"); - (true_term_nboyer = "\u1E9C*"); - trans_of_implies1_nboyer = function(n) { - var sc_n_15; - return ((sc_isEqual(n, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (n-(1)), n)), ((sc_n_15 = (n-(1))), ((sc_isEqual(sc_n_15, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (sc_n_15-(1)), sc_n_15)), (trans_of_implies1_nboyer((sc_n_15-(1))))))))))); - }; - is_term_equal_nboyer = function(x, y) { - var lst1; - var lst2; - var r2; - var r1; - if ((x instanceof sc_Pair)) - if ((y instanceof sc_Pair)) - if ((((r1 = (x.car)), (r2 = (y.car)), (r1===r2))!== false)) - { - (lst1 = (x.cdr)); - (lst2 = (y.cdr)); - while (true) { - if ((lst1 === null)) - return (lst2 === null); - else - if ((lst2 === null)) - return false; - else - if (((is_term_equal_nboyer((lst1.car), (lst2.car)))!== false)) - { - (lst1 = (lst1.cdr)); - (lst2 = (lst2.cdr)); - } - else - return false; - } - } - else - return false; - else - return false; - else - return (sc_isEqual(x, y)); - }; - is_term_member_nboyer = function(x, lst) { - var x; - var lst; + } + optrOpnd = falseHead1130.cdr; + return new sc_Pair( + ((symbol_record = term.car), symbol_record[0]), + optrOpnd + ); + } + }; + BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer = function (sym) { + var r; + var x; + return ( + (x = sc_assq(sym, BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer)), + x !== false + ? x.cdr + : ((r = [sym, null]), + (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = new sc_Pair( + new sc_Pair(sym, r), + BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer + )), + r) + ); + }; + BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null; + translate_alist_nboyer = function (alist) { + var sc_alist_6; + var term; + return alist === null + ? null + : new sc_Pair( + new sc_Pair( + alist.car.car, + ((term = alist.car.cdr), + !(term instanceof sc_Pair) + ? term + : new sc_Pair( + BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(term.car), + translate_args_nboyer(term.cdr) + )) + ), + ((sc_alist_6 = alist.cdr), + sc_alist_6 === null + ? null + : new sc_Pair( + new sc_Pair( + sc_alist_6.car.car, + translate_term_nboyer(sc_alist_6.car.cdr) + ), + translate_alist_nboyer(sc_alist_6.cdr) + )) + ); + }; + apply_subst_nboyer = function (alist, term) { + var lst; + var temp_temp; + return !(term instanceof sc_Pair) + ? ((temp_temp = sc_assq(term, alist)), + temp_temp !== false ? temp_temp.cdr : term) + : new sc_Pair( + term.car, + ((lst = term.cdr), + lst === null + ? null + : new sc_Pair( + apply_subst_nboyer(alist, lst.car), + apply_subst_lst_nboyer(alist, lst.cdr) + )) + ); + }; + apply_subst_lst_nboyer = function (alist, lst) { + var sc_lst_7; + return lst === null + ? null + : new sc_Pair( + apply_subst_nboyer(alist, lst.car), + ((sc_lst_7 = lst.cdr), + sc_lst_7 === null + ? null + : new sc_Pair( + apply_subst_nboyer(alist, sc_lst_7.car), + apply_subst_lst_nboyer(alist, sc_lst_7.cdr) + )) + ); + }; + tautologyp_nboyer = function (sc_x_11, true_lst, false_lst) { + var tmp1125; + var x; + var tmp1126; + var sc_x_8; + var sc_tmp1125_9; + var sc_tmp1126_10; + var sc_x_11; + var true_lst; + var false_lst; + while (true) { + if ( + ((sc_tmp1126_10 = is_term_equal_nboyer(sc_x_11, true_term_nboyer)), + sc_tmp1126_10 !== false + ? sc_tmp1126_10 + : is_term_member_nboyer(sc_x_11, true_lst)) !== false + ) + return true; + else if ( + ((sc_tmp1125_9 = is_term_equal_nboyer(sc_x_11, false_term_nboyer)), + sc_tmp1125_9 !== false + ? sc_tmp1125_9 + : is_term_member_nboyer(sc_x_11, false_lst)) !== false + ) + return false; + else if (!(sc_x_11 instanceof sc_Pair)) return false; + else if (sc_x_11.car === if_constructor_nboyer) + if ( + ((sc_x_8 = sc_x_11.cdr.car), + (tmp1126 = is_term_equal_nboyer(sc_x_8, true_term_nboyer)), + tmp1126 !== false + ? tmp1126 + : is_term_member_nboyer(sc_x_8, true_lst)) !== false + ) + sc_x_11 = sc_x_11.cdr.cdr.car; + else if ( + ((x = sc_x_11.cdr.car), + (tmp1125 = is_term_equal_nboyer(x, false_term_nboyer)), + tmp1125 !== false ? tmp1125 : is_term_member_nboyer(x, false_lst)) !== + false + ) + sc_x_11 = sc_x_11.cdr.cdr.cdr.car; + else if ( + tautologyp_nboyer( + sc_x_11.cdr.cdr.car, + new sc_Pair(sc_x_11.cdr.car, true_lst), + false_lst + ) !== false + ) { + false_lst = new sc_Pair(sc_x_11.cdr.car, false_lst); + sc_x_11 = sc_x_11.cdr.cdr.cdr.car; + } else return false; + else return false; + } + }; + if_constructor_nboyer = "\u1E9C*"; + rewrite_count_nboyer = 0; + rewrite_nboyer = function (term) { + var term2; + var sc_term_12; + var lst; + var symbol_record; + var sc_lst_13; + { + ++rewrite_count_nboyer; + if (!(term instanceof sc_Pair)) return term; + else { + sc_term_12 = new sc_Pair( + term.car, + ((sc_lst_13 = term.cdr), + sc_lst_13 === null + ? null + : new sc_Pair( + rewrite_nboyer(sc_lst_13.car), + rewrite_args_nboyer(sc_lst_13.cdr) + )) + ); + lst = ((symbol_record = term.car), symbol_record[1]); while (true) { - if ((lst === null)) - return false; - else - if (((is_term_equal_nboyer(x, (lst.car)))!== false)) - return true; - else - (lst = (lst.cdr)); + if (lst === null) return sc_term_12; + else if ( + ((term2 = lst.car.cdr.car), + (unify_subst_nboyer = null), + one_way_unify1_nboyer(sc_term_12, term2)) !== false + ) + return rewrite_nboyer( + apply_subst_nboyer(unify_subst_nboyer, lst.car.cdr.cdr.car) + ); + else lst = lst.cdr; } - }; - BgL_setupzd2boyerzd2 = function() { - var symbol_record; - var value; - var BgL_sc_symbolzd2record_16zd2; - var sym; - var sc_sym_17; - var term; - var lst; - var sc_term_18; - var sc_term_19; + } + } + }; + rewrite_args_nboyer = function (lst) { + var sc_lst_14; + return lst === null + ? null + : new sc_Pair( + rewrite_nboyer(lst.car), + ((sc_lst_14 = lst.cdr), + sc_lst_14 === null + ? null + : new sc_Pair( + rewrite_nboyer(sc_lst_14.car), + rewrite_args_nboyer(sc_lst_14.cdr) + )) + ); + }; + unify_subst_nboyer = "\u1E9C*"; + one_way_unify1_nboyer = function (term1, term2) { + var lst1; + var lst2; + var temp_temp; + if (!(term2 instanceof sc_Pair)) { + temp_temp = sc_assq(term2, unify_subst_nboyer); + if (temp_temp !== false) + return is_term_equal_nboyer(term1, temp_temp.cdr); + else if (sc_isNumber(term2)) return sc_isEqual(term1, term2); + else { + unify_subst_nboyer = new sc_Pair( + new sc_Pair(term2, term1), + unify_subst_nboyer + ); + return true; + } + } else if (!(term1 instanceof sc_Pair)) return false; + else if (term1.car === term2.car) { + lst1 = term1.cdr; + lst2 = term2.cdr; + while (true) { + if (lst1 === null) return lst2 === null; + else if (lst2 === null) return false; + else if (one_way_unify1_nboyer(lst1.car, lst2.car) !== false) { + lst1 = lst1.cdr; + lst2 = lst2.cdr; + } else return false; + } + } else return false; + }; + false_term_nboyer = "\u1E9C*"; + true_term_nboyer = "\u1E9C*"; + trans_of_implies1_nboyer = function (n) { + var sc_n_15; + return sc_isEqual(n, 1) + ? sc_list("\u1E9Cimplies", 0, 1) + : sc_list( + "\u1E9Cand", + sc_list("\u1E9Cimplies", n - 1, n), + ((sc_n_15 = n - 1), + sc_isEqual(sc_n_15, 1) + ? sc_list("\u1E9Cimplies", 0, 1) + : sc_list( + "\u1E9Cand", + sc_list("\u1E9Cimplies", sc_n_15 - 1, sc_n_15), + trans_of_implies1_nboyer(sc_n_15 - 1) + )) + ); + }; + is_term_equal_nboyer = function (x, y) { + var lst1; + var lst2; + var r2; + var r1; + if (x instanceof sc_Pair) + if (y instanceof sc_Pair) + if (((r1 = x.car), (r2 = y.car), r1 === r2) !== false) { + lst1 = x.cdr; + lst2 = y.cdr; + while (true) { + if (lst1 === null) return lst2 === null; + else if (lst2 === null) return false; + else if (is_term_equal_nboyer(lst1.car, lst2.car) !== false) { + lst1 = lst1.cdr; + lst2 = lst2.cdr; + } else return false; + } + } else return false; + else return false; + else return sc_isEqual(x, y); + }; + is_term_member_nboyer = function (x, lst) { + var x; + var lst; + while (true) { + if (lst === null) return false; + else if (is_term_equal_nboyer(x, lst.car) !== false) return true; + else lst = lst.cdr; + } + }; + BgL_setupzd2boyerzd2 = function () { + var symbol_record; + var value; + var BgL_sc_symbolzd2record_16zd2; + var sym; + var sc_sym_17; + var term; + var lst; + var sc_term_18; + var sc_term_19; + { + BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null; + if_constructor_nboyer = + BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer("\u1E9Cif"); + false_term_nboyer = + ((sc_term_19 = new sc_Pair("\u1E9Cf", null)), + !(sc_term_19 instanceof sc_Pair) + ? sc_term_19 + : new sc_Pair( + BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_term_19.car), + translate_args_nboyer(sc_term_19.cdr) + )); + true_term_nboyer = + ((sc_term_18 = new sc_Pair("\u1E9Ct", null)), + !(sc_term_18 instanceof sc_Pair) + ? sc_term_18 + : new sc_Pair( + BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_term_18.car), + translate_args_nboyer(sc_term_18.cdr) + )); + lst = sc_const_3_nboyer; + while (!(lst === null)) { { - (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null); - (if_constructor_nboyer = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer("\u1E9Cif"))); - (false_term_nboyer = ((sc_term_19 = (new sc_Pair("\u1E9Cf",null))), (!(sc_term_19 instanceof sc_Pair)?sc_term_19:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_19.car))), (translate_args_nboyer((sc_term_19.cdr)))))))); - (true_term_nboyer = ((sc_term_18 = (new sc_Pair("\u1E9Ct",null))), (!(sc_term_18 instanceof sc_Pair)?sc_term_18:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_18.car))), (translate_args_nboyer((sc_term_18.cdr)))))))); - (lst = sc_const_3_nboyer); - while (!(lst === null)) { - { - (term = (lst.car)); - if (((term instanceof sc_Pair)&&(((term.car)==="\u1E9Cequal")&&((term.cdr.car) instanceof sc_Pair)))) - { - (sc_sym_17 = ((term.cdr.car).car)); - (value = (new sc_Pair((!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr)))))), ((sym = ((term.cdr.car).car)), (BgL_sc_symbolzd2record_16zd2 = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sym))), (BgL_sc_symbolzd2record_16zd2[(1)]))))); - (symbol_record = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_sym_17))); - (symbol_record[(1)] = value); - } - else - (sc_error("ADD-LEMMA did not like term: ", term)); - (lst = (lst.cdr)); - } - } - return true; + term = lst.car; + if ( + term instanceof sc_Pair && + term.car === "\u1E9Cequal" && + term.cdr.car instanceof sc_Pair + ) { + sc_sym_17 = term.cdr.car.car; + value = new sc_Pair( + !(term instanceof sc_Pair) + ? term + : new sc_Pair( + BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(term.car), + translate_args_nboyer(term.cdr) + ), + ((sym = term.cdr.car.car), + (BgL_sc_symbolzd2record_16zd2 = + BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sym)), + BgL_sc_symbolzd2record_16zd2[1]) + ); + symbol_record = + BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_sym_17); + symbol_record[1] = value; + } else sc_error("ADD-LEMMA did not like term: ", term); + lst = lst.cdr; } - }; - BgL_testzd2boyerzd2 = function(n) { - var optrOpnd; - var term; - var sc_n_20; - var answer; - var sc_term_21; - var sc_term_22; + } + return true; + } + }; + BgL_testzd2boyerzd2 = function (n) { + var optrOpnd; + var term; + var sc_n_20; + var answer; + var sc_term_21; + var sc_term_22; + { + rewrite_count_nboyer = 0; + term = sc_const_4_nboyer; + sc_n_20 = n; + while (!(sc_n_20 === 0)) { { - (rewrite_count_nboyer = (0)); - (term = sc_const_4_nboyer); - (sc_n_20 = n); - while (!(sc_n_20=== 0)) { - { - (term = (sc_list("\u1E9Cor", term, (new sc_Pair("\u1E9Cf",null))))); - (--sc_n_20); - } - } - (sc_term_22 = term); - if (!(sc_term_22 instanceof sc_Pair)) - (optrOpnd = sc_term_22); - else - (optrOpnd = (new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_22.car))), (translate_args_nboyer((sc_term_22.cdr)))))); - (sc_term_21 = (apply_subst_nboyer(((const_nboyer === null)?null:(new sc_Pair((new sc_Pair((const_nboyer.car.car), (translate_term_nboyer((const_nboyer.car.cdr))))), (translate_alist_nboyer((const_nboyer.cdr)))))), optrOpnd))); - (answer = (tautologyp_nboyer((rewrite_nboyer(sc_term_21)), null, null))); - (sc_write(rewrite_count_nboyer)); - (sc_display(" rewrites")); - (sc_newline()); - if ((answer!== false)) - return rewrite_count_nboyer; - else - return false; + term = sc_list("\u1E9Cor", term, new sc_Pair("\u1E9Cf", null)); + --sc_n_20; } - }; + } + sc_term_22 = term; + if (!(sc_term_22 instanceof sc_Pair)) optrOpnd = sc_term_22; + else + optrOpnd = new sc_Pair( + BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_term_22.car), + translate_args_nboyer(sc_term_22.cdr) + ); + sc_term_21 = apply_subst_nboyer( + const_nboyer === null + ? null + : new sc_Pair( + new sc_Pair( + const_nboyer.car.car, + translate_term_nboyer(const_nboyer.car.cdr) + ), + translate_alist_nboyer(const_nboyer.cdr) + ), + optrOpnd + ); + answer = tautologyp_nboyer(rewrite_nboyer(sc_term_21), null, null); + sc_write(rewrite_count_nboyer); + sc_display(" rewrites"); + sc_newline(); + if (answer !== false) return rewrite_count_nboyer; + else return false; + } + }; } /* Exported Variables */ var BgL_parsezd2ze3nbzd2treesze3; @@ -3809,850 +7545,1203 @@ var BgL_makezd2parserzd2; var const_earley; { - (const_earley = (new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair((new sc_Pair("\u1E9Ca",null)),(new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair("\u1E9Cs",null)))),null)))))),null))); - BgL_makezd2parserzd2 = function(grammar, lexer) { + const_earley = new sc_Pair( + new sc_Pair( + "\u1E9Cs", + new sc_Pair( + new sc_Pair("\u1E9Ca", null), + new sc_Pair(new sc_Pair("\u1E9Cs", new sc_Pair("\u1E9Cs", null)), null) + ) + ), + null + ); + BgL_makezd2parserzd2 = function (grammar, lexer) { + var i; + var parser_descr; + var def_loop; + var nb_nts; + var names; + var steps; + var predictors; + var enders; + var starters; + var nts; + var sc_names_1; + var sc_steps_2; + var sc_predictors_3; + var sc_enders_4; + var sc_starters_5; + var nb_confs; + var BgL_sc_defzd2loop_6zd2; + var BgL_sc_nbzd2nts_7zd2; + var sc_nts_8; + var BgL_sc_defzd2loop_9zd2; + var ind; + { + ind = function (nt, sc_nts_10) { var i; - var parser_descr; - var def_loop; - var nb_nts; - var names; - var steps; - var predictors; - var enders; - var starters; - var nts; - var sc_names_1; - var sc_steps_2; - var sc_predictors_3; - var sc_enders_4; - var sc_starters_5; - var nb_confs; - var BgL_sc_defzd2loop_6zd2; - var BgL_sc_nbzd2nts_7zd2; - var sc_nts_8; - var BgL_sc_defzd2loop_9zd2; - var ind; { - ind = function(nt, sc_nts_10) { - var i; - { - (i = ((sc_nts_10.length)-(1))); - while (true) { - if ((i>=(0))) - if ((sc_isEqual((sc_nts_10[i]), nt))) - return i; - else - (--i); - else - return false; + i = sc_nts_10.length - 1; + while (true) { + if (i >= 0) + if (sc_isEqual(sc_nts_10[i], nt)) return i; + else --i; + else return false; + } + } + }; + sc_nts_8 = + ((BgL_sc_defzd2loop_9zd2 = function (defs, sc_nts_11) { + var rule_loop; + var head; + var def; + return defs instanceof sc_Pair + ? ((def = defs.car), + (head = def.car), + (rule_loop = function (rules, sc_nts_12) { + var nt; + var l; + var sc_nts_13; + var rule; + if (rules instanceof sc_Pair) { + rule = rules.car; + l = rule; + sc_nts_13 = sc_nts_12; + while (l instanceof sc_Pair) { + { + nt = l.car; + l = l.cdr; + sc_nts_13 = + sc_member(nt, sc_nts_13) !== false + ? sc_nts_13 + : new sc_Pair(nt, sc_nts_13); + } + } + return rule_loop(rules.cdr, sc_nts_13); + } else return BgL_sc_defzd2loop_9zd2(defs.cdr, sc_nts_12); + }), + rule_loop( + def.cdr, + sc_member(head, sc_nts_11) !== false + ? sc_nts_11 + : new sc_Pair(head, sc_nts_11) + )) + : sc_list2vector(sc_reverse(sc_nts_11)); + }), + BgL_sc_defzd2loop_9zd2(grammar, null)); + BgL_sc_nbzd2nts_7zd2 = sc_nts_8.length; + nb_confs = + ((BgL_sc_defzd2loop_6zd2 = function (defs, BgL_sc_nbzd2confs_14zd2) { + var rule_loop; + var def; + return defs instanceof sc_Pair + ? ((def = defs.car), + (rule_loop = function (rules, BgL_sc_nbzd2confs_15zd2) { + var l; + var BgL_sc_nbzd2confs_16zd2; + var rule; + if (rules instanceof sc_Pair) { + rule = rules.car; + l = rule; + BgL_sc_nbzd2confs_16zd2 = BgL_sc_nbzd2confs_15zd2; + while (l instanceof sc_Pair) { + { + l = l.cdr; + ++BgL_sc_nbzd2confs_16zd2; } + } + return rule_loop(rules.cdr, BgL_sc_nbzd2confs_16zd2 + 1); + } else + return BgL_sc_defzd2loop_6zd2( + defs.cdr, + BgL_sc_nbzd2confs_15zd2 + ); + }), + rule_loop(def.cdr, BgL_sc_nbzd2confs_14zd2)) + : BgL_sc_nbzd2confs_14zd2; + }), + BgL_sc_defzd2loop_6zd2(grammar, 0)) + BgL_sc_nbzd2nts_7zd2; + sc_starters_5 = sc_makeVector(BgL_sc_nbzd2nts_7zd2, null); + sc_enders_4 = sc_makeVector(BgL_sc_nbzd2nts_7zd2, null); + sc_predictors_3 = sc_makeVector(BgL_sc_nbzd2nts_7zd2, null); + sc_steps_2 = sc_makeVector(nb_confs, false); + sc_names_1 = sc_makeVector(nb_confs, false); + nts = sc_nts_8; + starters = sc_starters_5; + enders = sc_enders_4; + predictors = sc_predictors_3; + steps = sc_steps_2; + names = sc_names_1; + nb_nts = sc_nts_8.length; + i = nb_nts - 1; + while (i >= 0) { + { + sc_steps_2[i] = i - nb_nts; + sc_names_1[i] = sc_list(sc_nts_8[i], 0); + sc_enders_4[i] = sc_list(i); + --i; + } + } + def_loop = function (defs, conf) { + var rule_loop; + var head; + var def; + return defs instanceof sc_Pair + ? ((def = defs.car), + (head = def.car), + (rule_loop = function (rules, conf, rule_num) { + var i; + var sc_i_17; + var nt; + var l; + var sc_conf_18; + var sc_i_19; + var rule; + if (rules instanceof sc_Pair) { + rule = rules.car; + names[conf] = sc_list(head, rule_num); + sc_i_19 = ind(head, nts); + starters[sc_i_19] = new sc_Pair(conf, starters[sc_i_19]); + l = rule; + sc_conf_18 = conf; + while (l instanceof sc_Pair) { + { + nt = l.car; + steps[sc_conf_18] = ind(nt, nts); + sc_i_17 = ind(nt, nts); + predictors[sc_i_17] = new sc_Pair( + sc_conf_18, + predictors[sc_i_17] + ); + l = l.cdr; + ++sc_conf_18; + } } - }; - (sc_nts_8 = ((BgL_sc_defzd2loop_9zd2 = function(defs, sc_nts_11) { - var rule_loop; - var head; - var def; - return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, sc_nts_12) { - var nt; - var l; - var sc_nts_13; - var rule; - if ((rules instanceof sc_Pair)) - { - (rule = (rules.car)); - (l = rule); - (sc_nts_13 = sc_nts_12); - while ((l instanceof sc_Pair)) { - { - (nt = (l.car)); - (l = (l.cdr)); - (sc_nts_13 = (((sc_member(nt, sc_nts_13))!== false)?sc_nts_13:(new sc_Pair(nt, sc_nts_13)))); - } - } - return (rule_loop((rules.cdr), sc_nts_13)); - } - else - return (BgL_sc_defzd2loop_9zd2((defs.cdr), sc_nts_12)); - }), (rule_loop((def.cdr), (((sc_member(head, sc_nts_11))!== false)?sc_nts_11:(new sc_Pair(head, sc_nts_11)))))):(sc_list2vector((sc_reverse(sc_nts_11))))); - }), (BgL_sc_defzd2loop_9zd2(grammar, null)))); - (BgL_sc_nbzd2nts_7zd2 = (sc_nts_8.length)); - (nb_confs = (((BgL_sc_defzd2loop_6zd2 = function(defs, BgL_sc_nbzd2confs_14zd2) { - var rule_loop; - var def; - return ((defs instanceof sc_Pair)?((def = (defs.car)), (rule_loop = function(rules, BgL_sc_nbzd2confs_15zd2) { - var l; - var BgL_sc_nbzd2confs_16zd2; - var rule; - if ((rules instanceof sc_Pair)) - { - (rule = (rules.car)); - (l = rule); - (BgL_sc_nbzd2confs_16zd2 = BgL_sc_nbzd2confs_15zd2); - while ((l instanceof sc_Pair)) { - { - (l = (l.cdr)); - (++BgL_sc_nbzd2confs_16zd2); - } - } - return (rule_loop((rules.cdr), (BgL_sc_nbzd2confs_16zd2+(1)))); - } - else - return (BgL_sc_defzd2loop_6zd2((defs.cdr), BgL_sc_nbzd2confs_15zd2)); - }), (rule_loop((def.cdr), BgL_sc_nbzd2confs_14zd2))):BgL_sc_nbzd2confs_14zd2); - }), (BgL_sc_defzd2loop_6zd2(grammar, (0))))+BgL_sc_nbzd2nts_7zd2)); - (sc_starters_5 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); - (sc_enders_4 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); - (sc_predictors_3 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); - (sc_steps_2 = (sc_makeVector(nb_confs, false))); - (sc_names_1 = (sc_makeVector(nb_confs, false))); - (nts = sc_nts_8); - (starters = sc_starters_5); - (enders = sc_enders_4); - (predictors = sc_predictors_3); - (steps = sc_steps_2); - (names = sc_names_1); - (nb_nts = (sc_nts_8.length)); - (i = (nb_nts-(1))); - while ((i>=(0))) { + steps[sc_conf_18] = ind(head, nts) - nb_nts; + i = ind(head, nts); + enders[i] = new sc_Pair(sc_conf_18, enders[i]); + return rule_loop(rules.cdr, sc_conf_18 + 1, rule_num + 1); + } else return def_loop(defs.cdr, conf); + }), + rule_loop(def.cdr, conf, 1)) + : undefined; + }; + def_loop(grammar, sc_nts_8.length); + parser_descr = [ + lexer, + sc_nts_8, + sc_starters_5, + sc_enders_4, + sc_predictors_3, + sc_steps_2, + sc_names_1, + ]; + return function (input) { + var optrOpnd; + var sc_optrOpnd_20; + var sc_optrOpnd_21; + var sc_optrOpnd_22; + var loop1; + var BgL_sc_stateza2_23za2; + var toks; + var BgL_sc_nbzd2nts_24zd2; + var sc_steps_25; + var sc_enders_26; + var state_num; + var BgL_sc_statesza2_27za2; + var states; + var i; + var conf; + var l; + var tok_nts; + var sc_i_28; + var sc_i_29; + var l1; + var l2; + var tok; + var tail1129; + var L1125; + var goal_enders; + var BgL_sc_statesza2_30za2; + var BgL_sc_nbzd2nts_31zd2; + var BgL_sc_nbzd2confs_32zd2; + var nb_toks; + var goal_starters; + var sc_states_33; + var BgL_sc_nbzd2confs_34zd2; + var BgL_sc_nbzd2toks_35zd2; + var sc_toks_36; + var falseHead1128; + var sc_names_37; + var sc_steps_38; + var sc_predictors_39; + var sc_enders_40; + var sc_starters_41; + var sc_nts_42; + var lexer; + var sc_ind_43; + var make_states; + var BgL_sc_confzd2setzd2getza2_44za2; + var conf_set_merge_new_bang; + var conf_set_adjoin; + var BgL_sc_confzd2setzd2adjoinza2_45za2; + var BgL_sc_confzd2setzd2adjoinza2za2_46z00; + var conf_set_union; + var forw; + var is_parsed; + var deriv_trees; + var BgL_sc_derivzd2treesza2_47z70; + var nb_deriv_trees; + var BgL_sc_nbzd2derivzd2treesza2_48za2; + { + sc_ind_43 = function (nt, sc_nts_49) { + var i; + { + i = sc_nts_49.length - 1; + while (true) { + if (i >= 0) + if (sc_isEqual(sc_nts_49[i], nt)) return i; + else --i; + else return false; + } + } + }; + make_states = function ( + BgL_sc_nbzd2toks_50zd2, + BgL_sc_nbzd2confs_51zd2 + ) { + var v; + var i; + var sc_states_52; + { + sc_states_52 = sc_makeVector(BgL_sc_nbzd2toks_50zd2 + 1, false); + i = BgL_sc_nbzd2toks_50zd2; + while (i >= 0) { { - (sc_steps_2[i] = (i-nb_nts)); - (sc_names_1[i] = (sc_list((sc_nts_8[i]), (0)))); - (sc_enders_4[i] = (sc_list(i))); - (--i); + v = sc_makeVector(BgL_sc_nbzd2confs_51zd2 + 1, false); + v[0] = -1; + sc_states_52[i] = v; + --i; } + } + return sc_states_52; } - def_loop = function(defs, conf) { - var rule_loop; - var head; - var def; - return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, conf, rule_num) { - var i; - var sc_i_17; - var nt; - var l; - var sc_conf_18; - var sc_i_19; - var rule; - if ((rules instanceof sc_Pair)) - { - (rule = (rules.car)); - (names[conf] = (sc_list(head, rule_num))); - (sc_i_19 = (ind(head, nts))); - (starters[sc_i_19] = (new sc_Pair(conf, (starters[sc_i_19])))); - (l = rule); - (sc_conf_18 = conf); - while ((l instanceof sc_Pair)) { - { - (nt = (l.car)); - (steps[sc_conf_18] = (ind(nt, nts))); - (sc_i_17 = (ind(nt, nts))); - (predictors[sc_i_17] = (new sc_Pair(sc_conf_18, (predictors[sc_i_17])))); - (l = (l.cdr)); - (++sc_conf_18); - } - } - (steps[sc_conf_18] = ((ind(head, nts))-nb_nts)); - (i = (ind(head, nts))); - (enders[i] = (new sc_Pair(sc_conf_18, (enders[i])))); - return (rule_loop((rules.cdr), (sc_conf_18+(1)), (rule_num+(1)))); - } - else - return (def_loop((defs.cdr), conf)); - }), (rule_loop((def.cdr), conf, (1)))):undefined); - }; - (def_loop(grammar, (sc_nts_8.length))); - (parser_descr = [lexer, sc_nts_8, sc_starters_5, sc_enders_4, sc_predictors_3, sc_steps_2, sc_names_1]); - return function(input) { - var optrOpnd; - var sc_optrOpnd_20; - var sc_optrOpnd_21; - var sc_optrOpnd_22; - var loop1; - var BgL_sc_stateza2_23za2; - var toks; - var BgL_sc_nbzd2nts_24zd2; - var sc_steps_25; - var sc_enders_26; - var state_num; - var BgL_sc_statesza2_27za2; - var states; - var i; - var conf; - var l; - var tok_nts; - var sc_i_28; - var sc_i_29; - var l1; - var l2; - var tok; - var tail1129; - var L1125; - var goal_enders; - var BgL_sc_statesza2_30za2; - var BgL_sc_nbzd2nts_31zd2; - var BgL_sc_nbzd2confs_32zd2; - var nb_toks; - var goal_starters; - var sc_states_33; - var BgL_sc_nbzd2confs_34zd2; - var BgL_sc_nbzd2toks_35zd2; - var sc_toks_36; - var falseHead1128; - var sc_names_37; - var sc_steps_38; - var sc_predictors_39; - var sc_enders_40; - var sc_starters_41; - var sc_nts_42; - var lexer; - var sc_ind_43; - var make_states; - var BgL_sc_confzd2setzd2getza2_44za2; - var conf_set_merge_new_bang; - var conf_set_adjoin; - var BgL_sc_confzd2setzd2adjoinza2_45za2; - var BgL_sc_confzd2setzd2adjoinza2za2_46z00; - var conf_set_union; - var forw; - var is_parsed; - var deriv_trees; - var BgL_sc_derivzd2treesza2_47z70; - var nb_deriv_trees; - var BgL_sc_nbzd2derivzd2treesza2_48za2; + }; + BgL_sc_confzd2setzd2getza2_44za2 = function ( + state, + BgL_sc_statezd2num_53zd2, + sc_conf_54 + ) { + var conf_set; + var BgL_sc_confzd2set_55zd2; + return ( + (BgL_sc_confzd2set_55zd2 = state[sc_conf_54 + 1]), + BgL_sc_confzd2set_55zd2 !== false + ? BgL_sc_confzd2set_55zd2 + : ((conf_set = sc_makeVector( + BgL_sc_statezd2num_53zd2 + 6, + false + )), + (conf_set[1] = -3), + (conf_set[2] = -1), + (conf_set[3] = -1), + (conf_set[4] = -1), + (state[sc_conf_54 + 1] = conf_set), + conf_set) + ); + }; + conf_set_merge_new_bang = function (conf_set) { + return ( + (conf_set[conf_set[1] + 5] = conf_set[4]), + (conf_set[1] = conf_set[3]), + (conf_set[3] = -1), + (conf_set[4] = -1) + ); + }; + conf_set_adjoin = function (state, conf_set, sc_conf_56, i) { + var tail; + return ( + (tail = conf_set[3]), + (conf_set[i + 5] = -1), + (conf_set[tail + 5] = i), + (conf_set[3] = i), + tail < 0 + ? ((conf_set[0] = state[0]), (state[0] = sc_conf_56)) + : undefined + ); + }; + BgL_sc_confzd2setzd2adjoinza2_45za2 = function ( + sc_states_57, + BgL_sc_statezd2num_58zd2, + l, + i + ) { + var conf_set; + var sc_conf_59; + var l1; + var state; + { + state = sc_states_57[BgL_sc_statezd2num_58zd2]; + l1 = l; + while (l1 instanceof sc_Pair) { { - sc_ind_43 = function(nt, sc_nts_49) { - var i; - { - (i = ((sc_nts_49.length)-(1))); - while (true) { - if ((i>=(0))) - if ((sc_isEqual((sc_nts_49[i]), nt))) - return i; - else - (--i); - else - return false; - } - } - }; - make_states = function(BgL_sc_nbzd2toks_50zd2, BgL_sc_nbzd2confs_51zd2) { - var v; - var i; - var sc_states_52; + sc_conf_59 = l1.car; + conf_set = BgL_sc_confzd2setzd2getza2_44za2( + state, + BgL_sc_statezd2num_58zd2, + sc_conf_59 + ); + if (conf_set[i + 5] === false) { + conf_set_adjoin(state, conf_set, sc_conf_59, i); + l1 = l1.cdr; + } else l1 = l1.cdr; + } + } + return undefined; + } + }; + BgL_sc_confzd2setzd2adjoinza2za2_46z00 = function ( + sc_states_60, + BgL_sc_statesza2_61za2, + BgL_sc_statezd2num_62zd2, + sc_conf_63, + i + ) { + var BgL_sc_confzd2setza2_64z70; + var BgL_sc_stateza2_65za2; + var conf_set; + var state; + return ( + (state = sc_states_60[BgL_sc_statezd2num_62zd2]), + ((conf_set = state[sc_conf_63 + 1]), + conf_set !== false ? conf_set[i + 5] : false) !== false + ? ((BgL_sc_stateza2_65za2 = + BgL_sc_statesza2_61za2[BgL_sc_statezd2num_62zd2]), + (BgL_sc_confzd2setza2_64z70 = + BgL_sc_confzd2setzd2getza2_44za2( + BgL_sc_stateza2_65za2, + BgL_sc_statezd2num_62zd2, + sc_conf_63 + )), + BgL_sc_confzd2setza2_64z70[i + 5] === false + ? conf_set_adjoin( + BgL_sc_stateza2_65za2, + BgL_sc_confzd2setza2_64z70, + sc_conf_63, + i + ) + : undefined, + true) + : false + ); + }; + conf_set_union = function (state, conf_set, sc_conf_66, other_set) { + var i; + { + i = other_set[2]; + while (i >= 0) { + if (conf_set[i + 5] === false) { + conf_set_adjoin(state, conf_set, sc_conf_66, i); + i = other_set[i + 5]; + } else i = other_set[i + 5]; + } + return undefined; + } + }; + forw = function ( + sc_states_67, + BgL_sc_statezd2num_68zd2, + sc_starters_69, + sc_enders_70, + sc_predictors_71, + sc_steps_72, + sc_nts_73 + ) { + var next_set; + var next; + var conf_set; + var ender; + var l; + var starter_set; + var starter; + var sc_l_74; + var sc_loop1_75; + var head; + var BgL_sc_confzd2set_76zd2; + var BgL_sc_statezd2num_77zd2; + var state; + var sc_states_78; + var preds; + var BgL_sc_confzd2set_79zd2; + var step; + var sc_conf_80; + var BgL_sc_nbzd2nts_81zd2; + var sc_state_82; + { + sc_state_82 = sc_states_67[BgL_sc_statezd2num_68zd2]; + BgL_sc_nbzd2nts_81zd2 = sc_nts_73.length; + while (true) { + { + sc_conf_80 = sc_state_82[0]; + if (sc_conf_80 >= 0) { + step = sc_steps_72[sc_conf_80]; + BgL_sc_confzd2set_79zd2 = sc_state_82[sc_conf_80 + 1]; + head = BgL_sc_confzd2set_79zd2[4]; + sc_state_82[0] = BgL_sc_confzd2set_79zd2[0]; + conf_set_merge_new_bang(BgL_sc_confzd2set_79zd2); + if (step >= 0) { + sc_l_74 = sc_starters_69[step]; + while (sc_l_74 instanceof sc_Pair) { { - (sc_states_52 = (sc_makeVector((BgL_sc_nbzd2toks_50zd2+(1)), false))); - (i = BgL_sc_nbzd2toks_50zd2); - while ((i>=(0))) { - { - (v = (sc_makeVector((BgL_sc_nbzd2confs_51zd2+(1)), false))); - (v[(0)] = (-1)); - (sc_states_52[i] = v); - (--i); - } - } - return sc_states_52; + starter = sc_l_74.car; + starter_set = BgL_sc_confzd2setzd2getza2_44za2( + sc_state_82, + BgL_sc_statezd2num_68zd2, + starter + ); + if ( + starter_set[BgL_sc_statezd2num_68zd2 + 5] === false + ) { + conf_set_adjoin( + sc_state_82, + starter_set, + starter, + BgL_sc_statezd2num_68zd2 + ); + sc_l_74 = sc_l_74.cdr; + } else sc_l_74 = sc_l_74.cdr; } - }; - BgL_sc_confzd2setzd2getza2_44za2 = function(state, BgL_sc_statezd2num_53zd2, sc_conf_54) { - var conf_set; - var BgL_sc_confzd2set_55zd2; - return ((BgL_sc_confzd2set_55zd2 = (state[(sc_conf_54+(1))])), ((BgL_sc_confzd2set_55zd2!== false)?BgL_sc_confzd2set_55zd2:((conf_set = (sc_makeVector((BgL_sc_statezd2num_53zd2+(6)), false))), (conf_set[(1)] = (-3)), (conf_set[(2)] = (-1)), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1)), (state[(sc_conf_54+(1))] = conf_set), conf_set))); - }; - conf_set_merge_new_bang = function(conf_set) { - return ((conf_set[((conf_set[(1)])+(5))] = (conf_set[(4)])), (conf_set[(1)] = (conf_set[(3)])), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1))); - }; - conf_set_adjoin = function(state, conf_set, sc_conf_56, i) { - var tail; - return ((tail = (conf_set[(3)])), (conf_set[(i+(5))] = (-1)), (conf_set[(tail+(5))] = i), (conf_set[(3)] = i), ((tail<(0))?((conf_set[(0)] = (state[(0)])), (state[(0)] = sc_conf_56)):undefined)); - }; - BgL_sc_confzd2setzd2adjoinza2_45za2 = function(sc_states_57, BgL_sc_statezd2num_58zd2, l, i) { - var conf_set; - var sc_conf_59; - var l1; - var state; + } + l = sc_enders_70[step]; + while (l instanceof sc_Pair) { { - (state = (sc_states_57[BgL_sc_statezd2num_58zd2])); - (l1 = l); - while ((l1 instanceof sc_Pair)) { - { - (sc_conf_59 = (l1.car)); - (conf_set = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_58zd2, sc_conf_59))); - if (((conf_set[(i+(5))])=== false)) - { - (conf_set_adjoin(state, conf_set, sc_conf_59, i)); - (l1 = (l1.cdr)); - } - else - (l1 = (l1.cdr)); - } - } - return undefined; + ender = l.car; + if ( + ((conf_set = sc_state_82[ender + 1]), + conf_set !== false + ? conf_set[BgL_sc_statezd2num_68zd2 + 5] + : false) !== false + ) { + next = sc_conf_80 + 1; + next_set = BgL_sc_confzd2setzd2getza2_44za2( + sc_state_82, + BgL_sc_statezd2num_68zd2, + next + ); + conf_set_union( + sc_state_82, + next_set, + next, + BgL_sc_confzd2set_79zd2 + ); + l = l.cdr; + } else l = l.cdr; } - }; - BgL_sc_confzd2setzd2adjoinza2za2_46z00 = function(sc_states_60, BgL_sc_statesza2_61za2, BgL_sc_statezd2num_62zd2, sc_conf_63, i) { - var BgL_sc_confzd2setza2_64z70; - var BgL_sc_stateza2_65za2; - var conf_set; - var state; - return ((state = (sc_states_60[BgL_sc_statezd2num_62zd2])), ((((conf_set = (state[(sc_conf_63+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)?((BgL_sc_stateza2_65za2 = (BgL_sc_statesza2_61za2[BgL_sc_statezd2num_62zd2])), (BgL_sc_confzd2setza2_64z70 = (BgL_sc_confzd2setzd2getza2_44za2(BgL_sc_stateza2_65za2, BgL_sc_statezd2num_62zd2, sc_conf_63))), (((BgL_sc_confzd2setza2_64z70[(i+(5))])=== false)?(conf_set_adjoin(BgL_sc_stateza2_65za2, BgL_sc_confzd2setza2_64z70, sc_conf_63, i)):undefined), true):false)); - }; - conf_set_union = function(state, conf_set, sc_conf_66, other_set) { + } + } else { + preds = sc_predictors_71[step + BgL_sc_nbzd2nts_81zd2]; + sc_states_78 = sc_states_67; + state = sc_state_82; + BgL_sc_statezd2num_77zd2 = BgL_sc_statezd2num_68zd2; + BgL_sc_confzd2set_76zd2 = BgL_sc_confzd2set_79zd2; + sc_loop1_75 = function (l) { + var sc_state_83; + var BgL_sc_nextzd2set_84zd2; + var sc_next_85; + var pred_set; var i; - { - (i = (other_set[(2)])); - while ((i>=(0))) { - if (((conf_set[(i+(5))])=== false)) - { - (conf_set_adjoin(state, conf_set, sc_conf_66, i)); - (i = (other_set[(i+(5))])); - } - else - (i = (other_set[(i+(5))])); + var pred; + if (l instanceof sc_Pair) { + pred = l.car; + i = head; + while (i >= 0) { + { + pred_set = + ((sc_state_83 = sc_states_78[i]), + sc_state_83[pred + 1]); + if (pred_set !== false) { + sc_next_85 = pred + 1; + BgL_sc_nextzd2set_84zd2 = + BgL_sc_confzd2setzd2getza2_44za2( + state, + BgL_sc_statezd2num_77zd2, + sc_next_85 + ); + conf_set_union( + state, + BgL_sc_nextzd2set_84zd2, + sc_next_85, + pred_set + ); + } + i = BgL_sc_confzd2set_76zd2[i + 5]; } - return undefined; - } - }; - forw = function(sc_states_67, BgL_sc_statezd2num_68zd2, sc_starters_69, sc_enders_70, sc_predictors_71, sc_steps_72, sc_nts_73) { - var next_set; - var next; - var conf_set; - var ender; - var l; - var starter_set; - var starter; - var sc_l_74; - var sc_loop1_75; - var head; - var BgL_sc_confzd2set_76zd2; - var BgL_sc_statezd2num_77zd2; - var state; - var sc_states_78; - var preds; - var BgL_sc_confzd2set_79zd2; - var step; - var sc_conf_80; - var BgL_sc_nbzd2nts_81zd2; - var sc_state_82; - { - (sc_state_82 = (sc_states_67[BgL_sc_statezd2num_68zd2])); - (BgL_sc_nbzd2nts_81zd2 = (sc_nts_73.length)); - while (true) { - { - (sc_conf_80 = (sc_state_82[(0)])); - if ((sc_conf_80>=(0))) - { - (step = (sc_steps_72[sc_conf_80])); - (BgL_sc_confzd2set_79zd2 = (sc_state_82[(sc_conf_80+(1))])); - (head = (BgL_sc_confzd2set_79zd2[(4)])); - (sc_state_82[(0)] = (BgL_sc_confzd2set_79zd2[(0)])); - (conf_set_merge_new_bang(BgL_sc_confzd2set_79zd2)); - if ((step>=(0))) - { - (sc_l_74 = (sc_starters_69[step])); - while ((sc_l_74 instanceof sc_Pair)) { - { - (starter = (sc_l_74.car)); - (starter_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, starter))); - if (((starter_set[(BgL_sc_statezd2num_68zd2+(5))])=== false)) - { - (conf_set_adjoin(sc_state_82, starter_set, starter, BgL_sc_statezd2num_68zd2)); - (sc_l_74 = (sc_l_74.cdr)); - } - else - (sc_l_74 = (sc_l_74.cdr)); - } - } - (l = (sc_enders_70[step])); - while ((l instanceof sc_Pair)) { - { - (ender = (l.car)); - if ((((conf_set = (sc_state_82[(ender+(1))])), ((conf_set!== false)?(conf_set[(BgL_sc_statezd2num_68zd2+(5))]):false))!== false)) - { - (next = (sc_conf_80+(1))); - (next_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, next))); - (conf_set_union(sc_state_82, next_set, next, BgL_sc_confzd2set_79zd2)); - (l = (l.cdr)); - } - else - (l = (l.cdr)); - } - } - } - else - { - (preds = (sc_predictors_71[(step+BgL_sc_nbzd2nts_81zd2)])); - (sc_states_78 = sc_states_67); - (state = sc_state_82); - (BgL_sc_statezd2num_77zd2 = BgL_sc_statezd2num_68zd2); - (BgL_sc_confzd2set_76zd2 = BgL_sc_confzd2set_79zd2); - sc_loop1_75 = function(l) { - var sc_state_83; - var BgL_sc_nextzd2set_84zd2; - var sc_next_85; - var pred_set; - var i; - var pred; - if ((l instanceof sc_Pair)) - { - (pred = (l.car)); - (i = head); - while ((i>=(0))) { - { - (pred_set = ((sc_state_83 = (sc_states_78[i])), (sc_state_83[(pred+(1))]))); - if ((pred_set!== false)) - { - (sc_next_85 = (pred+(1))); - (BgL_sc_nextzd2set_84zd2 = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_77zd2, sc_next_85))); - (conf_set_union(state, BgL_sc_nextzd2set_84zd2, sc_next_85, pred_set)); - } - (i = (BgL_sc_confzd2set_76zd2[(i+(5))])); - } - } - return (sc_loop1_75((l.cdr))); - } - else - return undefined; - }; - (sc_loop1_75(preds)); - } - } - else - return undefined; - } - } - } - }; - is_parsed = function(nt, i, j, sc_nts_86, sc_enders_87, sc_states_88) { - var conf_set; - var state; - var sc_conf_89; - var l; - var BgL_sc_ntza2_90za2; - { - (BgL_sc_ntza2_90za2 = (sc_ind_43(nt, sc_nts_86))); - if ((BgL_sc_ntza2_90za2!== false)) - { - (sc_nts_86.length); - (l = (sc_enders_87[BgL_sc_ntza2_90za2])); - while (true) { - if ((l instanceof sc_Pair)) - { - (sc_conf_89 = (l.car)); - if ((((state = (sc_states_88[j])), (conf_set = (state[(sc_conf_89+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) - return true; - else - (l = (l.cdr)); - } - else - return false; - } - } - else - return false; - } - }; - deriv_trees = function(sc_conf_91, i, j, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2) { - var sc_loop1_98; - var prev; - var name; - return ((name = (sc_names_94[sc_conf_91])), ((name!== false)?((sc_conf_91=(0))) - if (((k>=i)&&(((sc_state_99 = (sc_states_96[k])), (conf_set = (sc_state_99[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))) - { - (prev_trees = (deriv_trees(prev, i, k, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2))); - (ender_trees = (deriv_trees(ender, k, j, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2))); - loop3 = function(l3, l2) { - var l4; - var sc_l2_100; - var ender_tree; - if ((l3 instanceof sc_Pair)) - { - (ender_tree = (sc_list((l3.car)))); - (l4 = prev_trees); - (sc_l2_100 = l2); - while ((l4 instanceof sc_Pair)) { - { - (sc_l2_100 = (new sc_Pair((sc_append((l4.car), ender_tree)), sc_l2_100))); - (l4 = (l4.cdr)); - } - } - return (loop3((l3.cdr), sc_l2_100)); - } - else - return (loop2((ender_set[(k+(5))]), l2)); - }; - return (loop3(ender_trees, l2)); - } - else - (k = (ender_set[(k+(5))])); - else - return (sc_loop1_98((l1.cdr), l2)); - } - }; - return (loop2((ender_set[(2)]), l2)); - } - else - (l1 = (l1.cdr)); - } - else - return l2; - } - }), (sc_loop1_98((sc_enders_92[(sc_steps_93[prev])]), null))))); - }; - BgL_sc_derivzd2treesza2_47z70 = function(nt, i, j, sc_nts_101, sc_enders_102, sc_steps_103, sc_names_104, sc_toks_105, sc_states_106) { - var conf_set; - var state; - var sc_conf_107; - var l; - var trees; - var BgL_sc_nbzd2nts_108zd2; - var BgL_sc_ntza2_109za2; - { - (BgL_sc_ntza2_109za2 = (sc_ind_43(nt, sc_nts_101))); - if ((BgL_sc_ntza2_109za2!== false)) - { - (BgL_sc_nbzd2nts_108zd2 = (sc_nts_101.length)); - (l = (sc_enders_102[BgL_sc_ntza2_109za2])); - (trees = null); - while ((l instanceof sc_Pair)) { + if (k >= 0) + if ( + k >= i && + ((sc_state_99 = sc_states_96[k]), + (conf_set = sc_state_99[prev + 1]), + conf_set !== false + ? conf_set[i + 5] + : false) !== false + ) { + prev_trees = deriv_trees( + prev, + i, + k, + sc_enders_92, + sc_steps_93, + sc_names_94, + sc_toks_95, + sc_states_96, + BgL_sc_nbzd2nts_97zd2 + ); + ender_trees = deriv_trees( + ender, + k, + j, + sc_enders_92, + sc_steps_93, + sc_names_94, + sc_toks_95, + sc_states_96, + BgL_sc_nbzd2nts_97zd2 + ); + loop3 = function (l3, l2) { + var l4; + var sc_l2_100; + var ender_tree; + if (l3 instanceof sc_Pair) { + ender_tree = sc_list(l3.car); + l4 = prev_trees; + sc_l2_100 = l2; + while (l4 instanceof sc_Pair) { { - (sc_conf_107 = (l.car)); - if ((((state = (sc_states_106[j])), (conf_set = (state[(sc_conf_107+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) - { - (l = (l.cdr)); - (trees = (sc_append((deriv_trees(sc_conf_107, i, j, sc_enders_102, sc_steps_103, sc_names_104, sc_toks_105, sc_states_106, BgL_sc_nbzd2nts_108zd2)), trees))); - } - else - (l = (l.cdr)); + sc_l2_100 = new sc_Pair( + sc_append(l4.car, ender_tree), + sc_l2_100 + ); + l4 = l4.cdr; } - } - return trees; - } - else - return false; - } - }; - nb_deriv_trees = function(sc_conf_110, i, j, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2) { - var sc_loop1_116; - var tmp1124; - var prev; - return ((prev = (sc_conf_110-(1))), ((((tmp1124 = (sc_conf_110= 0) { + if ( + k >= i && + ((state = sc_states_114[k]), + (conf_set = state[prev + 1]), + conf_set !== false ? conf_set[i + 5] : false) !== + false + ) { + nb_prev_trees = nb_deriv_trees( + prev, + i, + k, + sc_enders_111, + sc_steps_112, + sc_toks_113, + sc_states_114, + BgL_sc_nbzd2nts_115zd2 + ); + nb_ender_trees = nb_deriv_trees( + ender, + k, + j, + sc_enders_111, + sc_steps_112, + sc_toks_113, + sc_states_114, + BgL_sc_nbzd2nts_115zd2 + ); + k = ender_set[k + 5]; + n += nb_prev_trees * nb_ender_trees; + } else k = ender_set[k + 5]; + } + return sc_loop1_116(l.cdr, n); + } else l = l.cdr; + } else return sc_n_118; + } + }), + sc_loop1_116(sc_enders_111[sc_steps_112[prev]], 0)) + ); + }; + BgL_sc_nbzd2derivzd2treesza2_48za2 = function ( + nt, + i, + j, + sc_nts_119, + sc_enders_120, + sc_steps_121, + sc_toks_122, + sc_states_123 + ) { + var conf_set; + var state; + var sc_conf_124; + var l; + var nb_trees; + var BgL_sc_nbzd2nts_125zd2; + var BgL_sc_ntza2_126za2; + { + BgL_sc_ntza2_126za2 = sc_ind_43(nt, sc_nts_119); + if (BgL_sc_ntza2_126za2 !== false) { + BgL_sc_nbzd2nts_125zd2 = sc_nts_119.length; + l = sc_enders_120[BgL_sc_ntza2_126za2]; + nb_trees = 0; + while (l instanceof sc_Pair) { + { + sc_conf_124 = l.car; + if ( + ((state = sc_states_123[j]), + (conf_set = state[sc_conf_124 + 1]), + conf_set !== false ? conf_set[i + 5] : false) !== false + ) { + l = l.cdr; + nb_trees = + nb_deriv_trees( + sc_conf_124, + i, + j, + sc_enders_120, + sc_steps_121, + sc_toks_122, + sc_states_123, + BgL_sc_nbzd2nts_125zd2 + ) + nb_trees; + } else l = l.cdr; + } + } + return nb_trees; + } else return false; + } + }; + lexer = parser_descr[0]; + sc_nts_42 = parser_descr[1]; + sc_starters_41 = parser_descr[2]; + sc_enders_40 = parser_descr[3]; + sc_predictors_39 = parser_descr[4]; + sc_steps_38 = parser_descr[5]; + sc_names_37 = parser_descr[6]; + falseHead1128 = new sc_Pair(null, null); + L1125 = lexer(input); + tail1129 = falseHead1128; + while (!(L1125 === null)) { + { + tok = L1125.car; + l1 = tok.cdr; + l2 = null; + while (l1 instanceof sc_Pair) { + { + sc_i_29 = sc_ind_43(l1.car, sc_nts_42); + if (sc_i_29 !== false) { + l1 = l1.cdr; + l2 = new sc_Pair(sc_i_29, l2); + } else l1 = l1.cdr; + } + } + sc_optrOpnd_22 = new sc_Pair(tok.car, sc_reverse(l2)); + sc_optrOpnd_21 = new sc_Pair(sc_optrOpnd_22, null); + tail1129.cdr = sc_optrOpnd_21; + tail1129 = tail1129.cdr; + L1125 = L1125.cdr; + } + } + sc_optrOpnd_20 = falseHead1128.cdr; + sc_toks_36 = sc_list2vector(sc_optrOpnd_20); + BgL_sc_nbzd2toks_35zd2 = sc_toks_36.length; + BgL_sc_nbzd2confs_34zd2 = sc_steps_38.length; + sc_states_33 = make_states( + BgL_sc_nbzd2toks_35zd2, + BgL_sc_nbzd2confs_34zd2 + ); + goal_starters = sc_starters_41[0]; + BgL_sc_confzd2setzd2adjoinza2_45za2( + sc_states_33, + 0, + goal_starters, + 0 + ); + forw( + sc_states_33, + 0, + sc_starters_41, + sc_enders_40, + sc_predictors_39, + sc_steps_38, + sc_nts_42 + ); + sc_i_28 = 0; + while (sc_i_28 < BgL_sc_nbzd2toks_35zd2) { + { + tok_nts = sc_toks_36[sc_i_28].cdr; + BgL_sc_confzd2setzd2adjoinza2_45za2( + sc_states_33, + sc_i_28 + 1, + tok_nts, + sc_i_28 + ); + forw( + sc_states_33, + sc_i_28 + 1, + sc_starters_41, + sc_enders_40, + sc_predictors_39, + sc_steps_38, + sc_nts_42 + ); + ++sc_i_28; + } + } + nb_toks = sc_toks_36.length; + BgL_sc_nbzd2confs_32zd2 = sc_steps_38.length; + BgL_sc_nbzd2nts_31zd2 = sc_nts_42.length; + BgL_sc_statesza2_30za2 = make_states( + nb_toks, + BgL_sc_nbzd2confs_32zd2 + ); + goal_enders = sc_enders_40[0]; + l = goal_enders; + while (l instanceof sc_Pair) { + { + conf = l.car; + BgL_sc_confzd2setzd2adjoinza2za2_46z00( + sc_states_33, + BgL_sc_statesza2_30za2, + nb_toks, + conf, + 0 + ); + l = l.cdr; + } + } + i = nb_toks; + while (i >= 0) { + { + states = sc_states_33; + BgL_sc_statesza2_27za2 = BgL_sc_statesza2_30za2; + state_num = i; + sc_enders_26 = sc_enders_40; + sc_steps_25 = sc_steps_38; + BgL_sc_nbzd2nts_24zd2 = BgL_sc_nbzd2nts_31zd2; + toks = sc_toks_36; + BgL_sc_stateza2_23za2 = BgL_sc_statesza2_30za2[i]; + loop1 = function () { + var sc_loop1_127; + var prev; + var BgL_sc_statesza2_128za2; + var sc_states_129; + var j; + var i; + var sc_i_130; + var head; + var conf_set; + var sc_conf_131; + { + sc_conf_131 = BgL_sc_stateza2_23za2[0]; + if (sc_conf_131 >= 0) { + conf_set = BgL_sc_stateza2_23za2[sc_conf_131 + 1]; + head = conf_set[4]; + BgL_sc_stateza2_23za2[0] = conf_set[0]; + conf_set_merge_new_bang(conf_set); + sc_i_130 = head; + while (sc_i_130 >= 0) { + { + i = sc_i_130; + j = state_num; + sc_states_129 = states; + BgL_sc_statesza2_128za2 = BgL_sc_statesza2_27za2; + prev = sc_conf_131 - 1; + if ( + sc_conf_131 >= BgL_sc_nbzd2nts_24zd2 && + sc_steps_25[prev] >= 0 + ) { + sc_loop1_127 = function (l) { var k; - var n; var ender_set; - var sc_state_117; + var state; var ender; var l; - var sc_n_118; while (true) { - if ((l instanceof sc_Pair)) + if (l instanceof sc_Pair) { + ender = l.car; + ender_set = + ((state = sc_states_129[j]), + state[ender + 1]); + if (ender_set !== false) { + k = ender_set[2]; + while (k >= 0) { { - (ender = (l.car)); - (ender_set = ((sc_state_117 = (sc_states_114[j])), (sc_state_117[(ender+(1))]))); - if ((ender_set!== false)) - { - (k = (ender_set[(2)])); - (n = sc_n_118); - while ((k>=(0))) { - if (((k>=i)&&(((state = (sc_states_114[k])), (conf_set = (state[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))) - { - (nb_prev_trees = (nb_deriv_trees(prev, i, k, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2))); - (nb_ender_trees = (nb_deriv_trees(ender, k, j, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2))); - (k = (ender_set[(k+(5))])); - (n +=(nb_prev_trees*nb_ender_trees)); - } - else - (k = (ender_set[(k+(5))])); - } - return (sc_loop1_116((l.cdr), n)); - } - else - (l = (l.cdr)); - } - else - return sc_n_118; - } - }), (sc_loop1_116((sc_enders_111[(sc_steps_112[prev])]), (0)))))); - }; - BgL_sc_nbzd2derivzd2treesza2_48za2 = function(nt, i, j, sc_nts_119, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123) { - var conf_set; - var state; - var sc_conf_124; - var l; - var nb_trees; - var BgL_sc_nbzd2nts_125zd2; - var BgL_sc_ntza2_126za2; - { - (BgL_sc_ntza2_126za2 = (sc_ind_43(nt, sc_nts_119))); - if ((BgL_sc_ntza2_126za2!== false)) - { - (BgL_sc_nbzd2nts_125zd2 = (sc_nts_119.length)); - (l = (sc_enders_120[BgL_sc_ntza2_126za2])); - (nb_trees = (0)); - while ((l instanceof sc_Pair)) { - { - (sc_conf_124 = (l.car)); - if ((((state = (sc_states_123[j])), (conf_set = (state[(sc_conf_124+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) - { - (l = (l.cdr)); - (nb_trees = ((nb_deriv_trees(sc_conf_124, i, j, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123, BgL_sc_nbzd2nts_125zd2))+nb_trees)); - } - else - (l = (l.cdr)); - } + if (k >= i) + if ( + BgL_sc_confzd2setzd2adjoinza2za2_46z00( + sc_states_129, + BgL_sc_statesza2_128za2, + k, + prev, + i + ) !== false + ) + BgL_sc_confzd2setzd2adjoinza2za2_46z00( + sc_states_129, + BgL_sc_statesza2_128za2, + j, + ender, + k + ); + k = ender_set[k + 5]; } - return nb_trees; - } - else - return false; - } - }; - (lexer = (parser_descr[(0)])); - (sc_nts_42 = (parser_descr[(1)])); - (sc_starters_41 = (parser_descr[(2)])); - (sc_enders_40 = (parser_descr[(3)])); - (sc_predictors_39 = (parser_descr[(4)])); - (sc_steps_38 = (parser_descr[(5)])); - (sc_names_37 = (parser_descr[(6)])); - (falseHead1128 = (new sc_Pair(null, null))); - (L1125 = (lexer(input))); - (tail1129 = falseHead1128); - while (!(L1125 === null)) { - { - (tok = (L1125.car)); - (l1 = (tok.cdr)); - (l2 = null); - while ((l1 instanceof sc_Pair)) { - { - (sc_i_29 = (sc_ind_43((l1.car), sc_nts_42))); - if ((sc_i_29!== false)) - { - (l1 = (l1.cdr)); - (l2 = (new sc_Pair(sc_i_29, l2))); - } - else - (l1 = (l1.cdr)); - } + } + return sc_loop1_127(l.cdr); + } else l = l.cdr; + } else return undefined; } - (sc_optrOpnd_22 = (new sc_Pair((tok.car), (sc_reverse(l2))))); - (sc_optrOpnd_21 = (new sc_Pair(sc_optrOpnd_22, null))); - (tail1129.cdr = sc_optrOpnd_21); - (tail1129 = (tail1129.cdr)); - (L1125 = (L1125.cdr)); + }; + sc_loop1_127(sc_enders_26[sc_steps_25[prev]]); } + sc_i_130 = conf_set[sc_i_130 + 5]; + } } - (sc_optrOpnd_20 = (falseHead1128.cdr)); - (sc_toks_36 = (sc_list2vector(sc_optrOpnd_20))); - (BgL_sc_nbzd2toks_35zd2 = (sc_toks_36.length)); - (BgL_sc_nbzd2confs_34zd2 = (sc_steps_38.length)); - (sc_states_33 = (make_states(BgL_sc_nbzd2toks_35zd2, BgL_sc_nbzd2confs_34zd2))); - (goal_starters = (sc_starters_41[(0)])); - (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33, (0), goal_starters, (0))); - (forw(sc_states_33, (0), sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_nts_42)); - (sc_i_28 = (0)); - while ((sc_i_28=(0))) { - { - (states = sc_states_33); - (BgL_sc_statesza2_27za2 = BgL_sc_statesza2_30za2); - (state_num = i); - (sc_enders_26 = sc_enders_40); - (sc_steps_25 = sc_steps_38); - (BgL_sc_nbzd2nts_24zd2 = BgL_sc_nbzd2nts_31zd2); - (toks = sc_toks_36); - (BgL_sc_stateza2_23za2 = (BgL_sc_statesza2_30za2[i])); - loop1 = function() { - var sc_loop1_127; - var prev; - var BgL_sc_statesza2_128za2; - var sc_states_129; - var j; - var i; - var sc_i_130; - var head; - var conf_set; - var sc_conf_131; - { - (sc_conf_131 = (BgL_sc_stateza2_23za2[(0)])); - if ((sc_conf_131>=(0))) - { - (conf_set = (BgL_sc_stateza2_23za2[(sc_conf_131+(1))])); - (head = (conf_set[(4)])); - (BgL_sc_stateza2_23za2[(0)] = (conf_set[(0)])); - (conf_set_merge_new_bang(conf_set)); - (sc_i_130 = head); - while ((sc_i_130>=(0))) { - { - (i = sc_i_130); - (j = state_num); - (sc_states_129 = states); - (BgL_sc_statesza2_128za2 = BgL_sc_statesza2_27za2); - (prev = (sc_conf_131-(1))); - if (((sc_conf_131>=BgL_sc_nbzd2nts_24zd2)&&((sc_steps_25[prev])>=(0)))) - { - sc_loop1_127 = function(l) { - var k; - var ender_set; - var state; - var ender; - var l; - while (true) { - if ((l instanceof sc_Pair)) - { - (ender = (l.car)); - (ender_set = ((state = (sc_states_129[j])), (state[(ender+(1))]))); - if ((ender_set!== false)) - { - (k = (ender_set[(2)])); - while ((k>=(0))) { - { - if ((k>=i)) - if (((BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, k, prev, i))!== false)) - (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, j, ender, k)); - (k = (ender_set[(k+(5))])); - } - } - return (sc_loop1_127((l.cdr))); - } - else - (l = (l.cdr)); - } - else - return undefined; - } - }; - (sc_loop1_127((sc_enders_26[(sc_steps_25[prev])]))); - } - (sc_i_130 = (conf_set[(sc_i_130+(5))])); - } - } - return (loop1()); - } - else - return undefined; - } - }; - (loop1()); - (--i); - } - } - (optrOpnd = BgL_sc_statesza2_30za2); - return [sc_nts_42, sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_names_37, sc_toks_36, optrOpnd, is_parsed, BgL_sc_derivzd2treesza2_47z70, BgL_sc_nbzd2derivzd2treesza2_48za2]; + return loop1(); + } else return undefined; } - }; + }; + loop1(); + --i; + } + } + optrOpnd = BgL_sc_statesza2_30za2; + return [ + sc_nts_42, + sc_starters_41, + sc_enders_40, + sc_predictors_39, + sc_steps_38, + sc_names_37, + sc_toks_36, + optrOpnd, + is_parsed, + BgL_sc_derivzd2treesza2_47z70, + BgL_sc_nbzd2derivzd2treesza2_48za2, + ]; } - }; - BgL_parsezd2ze3parsedzf3zc2 = function(parse, nt, i, j) { - var is_parsed; - var states; - var enders; - var nts; - return ((nts = (parse[(0)])), (enders = (parse[(2)])), (states = (parse[(7)])), (is_parsed = (parse[(8)])), (is_parsed(nt, i, j, nts, enders, states))); - }; - BgL_parsezd2ze3treesz31 = function(parse, nt, i, j) { - var BgL_sc_derivzd2treesza2_132z70; - var states; - var toks; - var names; - var steps; - var enders; - var nts; - return ((nts = (parse[(0)])), (enders = (parse[(2)])), (steps = (parse[(4)])), (names = (parse[(5)])), (toks = (parse[(6)])), (states = (parse[(7)])), (BgL_sc_derivzd2treesza2_132z70 = (parse[(9)])), (BgL_sc_derivzd2treesza2_132z70(nt, i, j, nts, enders, steps, names, toks, states))); - }; - BgL_parsezd2ze3nbzd2treesze3 = function(parse, nt, i, j) { - var BgL_sc_nbzd2derivzd2treesza2_133za2; - var states; - var toks; - var steps; - var enders; - var nts; - return ((nts = (parse[(0)])), (enders = (parse[(2)])), (steps = (parse[(4)])), (toks = (parse[(6)])), (states = (parse[(7)])), (BgL_sc_nbzd2derivzd2treesza2_133za2 = (parse[(10)])), (BgL_sc_nbzd2derivzd2treesza2_133za2(nt, i, j, nts, enders, steps, toks, states))); - }; - test = function(k) { - var x; - var p; - return ((p = (BgL_makezd2parserzd2(const_earley, function(l) { - var sc_x_134; - var tail1134; - var L1130; - var falseHead1133; + }; + } + }; + BgL_parsezd2ze3parsedzf3zc2 = function (parse, nt, i, j) { + var is_parsed; + var states; + var enders; + var nts; + return ( + (nts = parse[0]), + (enders = parse[2]), + (states = parse[7]), + (is_parsed = parse[8]), + is_parsed(nt, i, j, nts, enders, states) + ); + }; + BgL_parsezd2ze3treesz31 = function (parse, nt, i, j) { + var BgL_sc_derivzd2treesza2_132z70; + var states; + var toks; + var names; + var steps; + var enders; + var nts; + return ( + (nts = parse[0]), + (enders = parse[2]), + (steps = parse[4]), + (names = parse[5]), + (toks = parse[6]), + (states = parse[7]), + (BgL_sc_derivzd2treesza2_132z70 = parse[9]), + BgL_sc_derivzd2treesza2_132z70( + nt, + i, + j, + nts, + enders, + steps, + names, + toks, + states + ) + ); + }; + BgL_parsezd2ze3nbzd2treesze3 = function (parse, nt, i, j) { + var BgL_sc_nbzd2derivzd2treesza2_133za2; + var states; + var toks; + var steps; + var enders; + var nts; + return ( + (nts = parse[0]), + (enders = parse[2]), + (steps = parse[4]), + (toks = parse[6]), + (states = parse[7]), + (BgL_sc_nbzd2derivzd2treesza2_133za2 = parse[10]), + BgL_sc_nbzd2derivzd2treesza2_133za2( + nt, + i, + j, + nts, + enders, + steps, + toks, + states + ) + ); + }; + test = function (k) { + var x; + var p; + return ( + (p = BgL_makezd2parserzd2(const_earley, function (l) { + var sc_x_134; + var tail1134; + var L1130; + var falseHead1133; + { + falseHead1133 = new sc_Pair(null, null); + tail1134 = falseHead1133; + L1130 = l; + while (!(L1130 === null)) { { - (falseHead1133 = (new sc_Pair(null, null))); - (tail1134 = falseHead1133); - (L1130 = l); - while (!(L1130 === null)) { - { - (tail1134.cdr = (new sc_Pair(((sc_x_134 = (L1130.car)), (sc_list(sc_x_134, sc_x_134))), null))); - (tail1134 = (tail1134.cdr)); - (L1130 = (L1130.cdr)); - } - } - return (falseHead1133.cdr); + tail1134.cdr = new sc_Pair( + ((sc_x_134 = L1130.car), sc_list(sc_x_134, sc_x_134)), + null + ); + tail1134 = tail1134.cdr; + L1130 = L1130.cdr; } - }))), (x = (p((sc_vector2list((sc_makeVector(k, "\u1E9Ca"))))))), (sc_length((BgL_parsezd2ze3treesz31(x, "\u1E9Cs", (0), k))))); - }; - BgL_earleyzd2benchmarkzd2 = function() { - var args = null; - for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) { - args = sc_cons(arguments[sc_tmp], args); + } + return falseHead1133.cdr; } - var k; - return ((k = ((args === null)?(7):(args.car))), (BgL_runzd2benchmarkzd2("earley", (1), function() { - return (test(k)); - }, function(result) { - return ((sc_display(result)), (sc_newline()), result == 132); - }))); - }; + })), + (x = p(sc_vector2list(sc_makeVector(k, "\u1E9Ca")))), + sc_length(BgL_parsezd2ze3treesz31(x, "\u1E9Cs", 0, k)) + ); + }; + BgL_earleyzd2benchmarkzd2 = function () { + var args = null; + for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) { + args = sc_cons(arguments[sc_tmp], args); + } + var k; + return ( + (k = args === null ? 7 : args.car), + BgL_runzd2benchmarkzd2( + "earley", + 1, + function () { + return test(k); + }, + function (result) { + return sc_display(result), sc_newline(), result == 132; + } + ) + ); + }; } - /************* END OF GENERATED CODE *************/ // Invoke this function to run a benchmark. // The first argument is a string identifying the benchmark. @@ -4669,7 +8758,7 @@ var const_earley; // return (v instanceof Array) && (v.length == 1000000); // }); -SC_DEFAULT_OUT = new sc_GenericOutputPort(function(s) {}); +SC_DEFAULT_OUT = new sc_GenericOutputPort(function (s) {}); SC_ERROR_OUT = SC_DEFAULT_OUT; function RunBenchmark(name, count, run, warn) { diff --git a/benchmarks/v8-v7/navier-stokes.js b/benchmarks/v8-v7/navier-stokes.js index b0dc3c8645..e50e4b4339 100644 --- a/benchmarks/v8-v7/navier-stokes.js +++ b/benchmarks/v8-v7/navier-stokes.js @@ -24,364 +24,372 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -var NavierStokes = new BenchmarkSuite('NavierStokes', 1484000, - [new Benchmark('NavierStokes', - runNavierStokes, - setupNavierStokes, - tearDownNavierStokes)]); +var NavierStokes = new BenchmarkSuite("NavierStokes", 1484000, [ + new Benchmark( + "NavierStokes", + runNavierStokes, + setupNavierStokes, + tearDownNavierStokes + ), +]); var solver = null; -function runNavierStokes() -{ - solver.update(); +function runNavierStokes() { + solver.update(); } -function setupNavierStokes() -{ - solver = new FluidField(null); - solver.setResolution(128, 128); - solver.setIterations(20); - solver.setDisplayFunction(function(){}); - solver.setUICallback(prepareFrame); - solver.reset(); +function setupNavierStokes() { + solver = new FluidField(null); + solver.setResolution(128, 128); + solver.setIterations(20); + solver.setDisplayFunction(function () {}); + solver.setUICallback(prepareFrame); + solver.reset(); } -function tearDownNavierStokes() -{ - solver = null; +function tearDownNavierStokes() { + solver = null; } function addPoints(field) { - var n = 64; - for (var i = 1; i <= n; i++) { - field.setVelocity(i, i, n, n); - field.setDensity(i, i, 5); - field.setVelocity(i, n - i, -n, -n); - field.setDensity(i, n - i, 20); - field.setVelocity(128 - i, n + i, -n, -n); - field.setDensity(128 - i, n + i, 30); - } + var n = 64; + for (var i = 1; i <= n; i++) { + field.setVelocity(i, i, n, n); + field.setDensity(i, i, 5); + field.setVelocity(i, n - i, -n, -n); + field.setDensity(i, n - i, 20); + field.setVelocity(128 - i, n + i, -n, -n); + field.setDensity(128 - i, n + i, 30); + } } var framesTillAddingPoints = 0; var framesBetweenAddingPoints = 5; -function prepareFrame(field) -{ - if (framesTillAddingPoints == 0) { - addPoints(field); - framesTillAddingPoints = framesBetweenAddingPoints; - framesBetweenAddingPoints++; - } else { - framesTillAddingPoints--; - } +function prepareFrame(field) { + if (framesTillAddingPoints == 0) { + addPoints(field); + framesTillAddingPoints = framesBetweenAddingPoints; + framesBetweenAddingPoints++; + } else { + framesTillAddingPoints--; + } } // Code from Oliver Hunt (http://nerget.com/fluidSim/pressure.js) starts here. function FluidField(canvas) { - function addFields(x, s, dt) - { - for (var i=0; i Wp5) - x = Wp5; - var i0 = x | 0; - var i1 = i0 + 1; - if (y < 0.5) - y = 0.5; - else if (y > Hp5) - y = Hp5; - var j0 = y | 0; - var j1 = j0 + 1; - var s1 = x - i0; - var s0 = 1 - s1; - var t1 = y - j0; - var t0 = 1 - t1; - var row1 = j0 * rowSize; - var row2 = j1 * rowSize; - d[pos] = s0 * (t0 * d0[i0 + row1] + t1 * d0[i0 + row2]) + s1 * (t0 * d0[i1 + row1] + t1 * d0[i1 + row2]); - } - } - set_bnd(b, d); + function advect(b, d, d0, u, v, dt) { + var Wdt0 = dt * width; + var Hdt0 = dt * height; + var Wp5 = width + 0.5; + var Hp5 = height + 0.5; + for (var j = 1; j <= height; j++) { + var pos = j * rowSize; + for (var i = 1; i <= width; i++) { + var x = i - Wdt0 * u[++pos]; + var y = j - Hdt0 * v[pos]; + if (x < 0.5) x = 0.5; + else if (x > Wp5) x = Wp5; + var i0 = x | 0; + var i1 = i0 + 1; + if (y < 0.5) y = 0.5; + else if (y > Hp5) y = Hp5; + var j0 = y | 0; + var j1 = j0 + 1; + var s1 = x - i0; + var s0 = 1 - s1; + var t1 = y - j0; + var t0 = 1 - t1; + var row1 = j0 * rowSize; + var row2 = j1 * rowSize; + d[pos] = + s0 * (t0 * d0[i0 + row1] + t1 * d0[i0 + row2]) + + s1 * (t0 * d0[i1 + row1] + t1 * d0[i1 + row2]); + } } + set_bnd(b, d); + } - function project(u, v, p, div) - { - var h = -0.5 / Math.sqrt(width * height); - for (var j = 1 ; j <= height; j++ ) { - var row = j * rowSize; - var previousRow = (j - 1) * rowSize; - var prevValue = row - 1; - var currentRow = row; - var nextValue = row + 1; - var nextRow = (j + 1) * rowSize; - for (var i = 1; i <= width; i++ ) { - div[++currentRow] = h * (u[++nextValue] - u[++prevValue] + v[++nextRow] - v[++previousRow]); - p[currentRow] = 0; - } - } - set_bnd(0, div); - set_bnd(0, p); + function project(u, v, p, div) { + var h = -0.5 / Math.sqrt(width * height); + for (var j = 1; j <= height; j++) { + var row = j * rowSize; + var previousRow = (j - 1) * rowSize; + var prevValue = row - 1; + var currentRow = row; + var nextValue = row + 1; + var nextRow = (j + 1) * rowSize; + for (var i = 1; i <= width; i++) { + div[++currentRow] = + h * + (u[++nextValue] - u[++prevValue] + v[++nextRow] - v[++previousRow]); + p[currentRow] = 0; + } + } + set_bnd(0, div); + set_bnd(0, p); - lin_solve(0, p, div, 1, 4 ); - var wScale = 0.5 * width; - var hScale = 0.5 * height; - for (var j = 1; j<= height; j++ ) { - var prevPos = j * rowSize - 1; - var currentPos = j * rowSize; - var nextPos = j * rowSize + 1; - var prevRow = (j - 1) * rowSize; - var currentRow = j * rowSize; - var nextRow = (j + 1) * rowSize; + lin_solve(0, p, div, 1, 4); + var wScale = 0.5 * width; + var hScale = 0.5 * height; + for (var j = 1; j <= height; j++) { + var prevPos = j * rowSize - 1; + var currentPos = j * rowSize; + var nextPos = j * rowSize + 1; + var prevRow = (j - 1) * rowSize; + var currentRow = j * rowSize; + var nextRow = (j + 1) * rowSize; - for (var i = 1; i<= width; i++) { - u[++currentPos] -= wScale * (p[++nextPos] - p[++prevPos]); - v[currentPos] -= hScale * (p[++nextRow] - p[++prevRow]); - } - } - set_bnd(1, u); - set_bnd(2, v); + for (var i = 1; i <= width; i++) { + u[++currentPos] -= wScale * (p[++nextPos] - p[++prevPos]); + v[currentPos] -= hScale * (p[++nextRow] - p[++prevRow]); + } } + set_bnd(1, u); + set_bnd(2, v); + } - function dens_step(x, x0, u, v, dt) - { - addFields(x, x0, dt); - diffuse(0, x0, x, dt ); - advect(0, x, x0, u, v, dt ); - } + function dens_step(x, x0, u, v, dt) { + addFields(x, x0, dt); + diffuse(0, x0, x, dt); + advect(0, x, x0, u, v, dt); + } - function vel_step(u, v, u0, v0, dt) - { - addFields(u, u0, dt ); - addFields(v, v0, dt ); - var temp = u0; u0 = u; u = temp; - var temp = v0; v0 = v; v = temp; - diffuse2(u,u0,v,v0, dt); - project(u, v, u0, v0); - var temp = u0; u0 = u; u = temp; - var temp = v0; v0 = v; v = temp; - advect(1, u, u0, u0, v0, dt); - advect(2, v, v0, u0, v0, dt); - project(u, v, u0, v0 ); - } - var uiCallback = function(d,u,v) {}; + function vel_step(u, v, u0, v0, dt) { + addFields(u, u0, dt); + addFields(v, v0, dt); + var temp = u0; + u0 = u; + u = temp; + var temp = v0; + v0 = v; + v = temp; + diffuse2(u, u0, v, v0, dt); + project(u, v, u0, v0); + var temp = u0; + u0 = u; + u = temp; + var temp = v0; + v0 = v; + v = temp; + advect(1, u, u0, u0, v0, dt); + advect(2, v, v0, u0, v0, dt); + project(u, v, u0, v0); + } + var uiCallback = function (d, u, v) {}; - function Field(dens, u, v) { - // Just exposing the fields here rather than using accessors is a measurable win during display (maybe 5%) - // but makes the code ugly. - this.setDensity = function(x, y, d) { - dens[(x + 1) + (y + 1) * rowSize] = d; - } - this.getDensity = function(x, y) { - return dens[(x + 1) + (y + 1) * rowSize]; - } - this.setVelocity = function(x, y, xv, yv) { - u[(x + 1) + (y + 1) * rowSize] = xv; - v[(x + 1) + (y + 1) * rowSize] = yv; - } - this.getXVelocity = function(x, y) { - return u[(x + 1) + (y + 1) * rowSize]; - } - this.getYVelocity = function(x, y) { - return v[(x + 1) + (y + 1) * rowSize]; - } - this.width = function() { return width; } - this.height = function() { return height; } - } - function queryUI(d, u, v) - { - for (var i = 0; i < size; i++) - u[i] = v[i] = d[i] = 0.0; - uiCallback(new Field(d, u, v)); - } + function Field(dens, u, v) { + // Just exposing the fields here rather than using accessors is a measurable win during display (maybe 5%) + // but makes the code ugly. + this.setDensity = function (x, y, d) { + dens[x + 1 + (y + 1) * rowSize] = d; + }; + this.getDensity = function (x, y) { + return dens[x + 1 + (y + 1) * rowSize]; + }; + this.setVelocity = function (x, y, xv, yv) { + u[x + 1 + (y + 1) * rowSize] = xv; + v[x + 1 + (y + 1) * rowSize] = yv; + }; + this.getXVelocity = function (x, y) { + return u[x + 1 + (y + 1) * rowSize]; + }; + this.getYVelocity = function (x, y) { + return v[x + 1 + (y + 1) * rowSize]; + }; + this.width = function () { + return width; + }; + this.height = function () { + return height; + }; + } + function queryUI(d, u, v) { + for (var i = 0; i < size; i++) u[i] = v[i] = d[i] = 0.0; + uiCallback(new Field(d, u, v)); + } - this.update = function () { - queryUI(dens_prev, u_prev, v_prev); - vel_step(u, v, u_prev, v_prev, dt); - dens_step(dens, dens_prev, u, v, dt); - displayFunc(new Field(dens, u, v)); - } - this.setDisplayFunction = function(func) { - displayFunc = func; - } + this.update = function () { + queryUI(dens_prev, u_prev, v_prev); + vel_step(u, v, u_prev, v_prev, dt); + dens_step(dens, dens_prev, u, v, dt); + displayFunc(new Field(dens, u, v)); + }; + this.setDisplayFunction = function (func) { + displayFunc = func; + }; - this.iterations = function() { return iterations; } - this.setIterations = function(iters) { - if (iters > 0 && iters <= 100) - iterations = iters; - } - this.setUICallback = function(callback) { - uiCallback = callback; - } - var iterations = 10; - var visc = 0.5; - var dt = 0.1; - var dens; - var dens_prev; - var u; - var u_prev; - var v; - var v_prev; - var width; - var height; - var rowSize; - var size; - var displayFunc; - function reset() - { - rowSize = width + 2; - size = (width+2)*(height+2); - dens = new Array(size); - dens_prev = new Array(size); - u = new Array(size); - u_prev = new Array(size); - v = new Array(size); - v_prev = new Array(size); - for (var i = 0; i < size; i++) - dens_prev[i] = u_prev[i] = v_prev[i] = dens[i] = u[i] = v[i] = 0; - } - this.reset = reset; - this.setResolution = function (hRes, wRes) - { - var res = wRes * hRes; - if (res > 0 && res < 1000000 && (wRes != width || hRes != height)) { - width = wRes; - height = hRes; - reset(); - return true; - } - return false; + this.iterations = function () { + return iterations; + }; + this.setIterations = function (iters) { + if (iters > 0 && iters <= 100) iterations = iters; + }; + this.setUICallback = function (callback) { + uiCallback = callback; + }; + var iterations = 10; + var visc = 0.5; + var dt = 0.1; + var dens; + var dens_prev; + var u; + var u_prev; + var v; + var v_prev; + var width; + var height; + var rowSize; + var size; + var displayFunc; + function reset() { + rowSize = width + 2; + size = (width + 2) * (height + 2); + dens = new Array(size); + dens_prev = new Array(size); + u = new Array(size); + u_prev = new Array(size); + v = new Array(size); + v_prev = new Array(size); + for (var i = 0; i < size; i++) + dens_prev[i] = u_prev[i] = v_prev[i] = dens[i] = u[i] = v[i] = 0; + } + this.reset = reset; + this.setResolution = function (hRes, wRes) { + var res = wRes * hRes; + if (res > 0 && res < 1000000 && (wRes != width || hRes != height)) { + width = wRes; + height = hRes; + reset(); + return true; } - this.setResolution(64, 64); + return false; + }; + this.setResolution(64, 64); } diff --git a/benchmarks/v8-v7/raytrace.js b/benchmarks/v8-v7/raytrace.js index 971ef7218e..5d3aba128f 100644 --- a/benchmarks/v8-v7/raytrace.js +++ b/benchmarks/v8-v7/raytrace.js @@ -8,16 +8,14 @@ // untouched. This file also contains a copy of parts of the Prototype // JavaScript framework which is used by the ray tracer. -var RayTrace = new BenchmarkSuite('RayTrace', 739989, [ - new Benchmark('RayTrace', renderScene) +var RayTrace = new BenchmarkSuite("RayTrace", 739989, [ + new Benchmark("RayTrace", renderScene), ]); - // Variable used to hold a number that can be used to verify that // the scene was ray traced correctly. var checkNumber; - // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ @@ -29,24 +27,21 @@ var checkNumber; // Prototype is freely distributable under the terms of an MIT-style license. // For details, see the Prototype web site: http://prototype.conio.net/ - var Class = { - create: function() { - return function() { + create: function () { + return function () { this.initialize.apply(this, arguments); - } - } + }; + }, }; - -Object.extend = function(destination, source) { +Object.extend = function (destination, source) { for (var property in source) { destination[property] = source[property]; } return destination; }; - // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ @@ -69,836 +64,892 @@ Object.extend = function(destination, source) { // flog/background.js // flog/engine.js - /* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; +if (typeof Flog == "undefined") var Flog = {}; +if (typeof Flog.RayTracer == "undefined") Flog.RayTracer = {}; Flog.RayTracer.Color = Class.create(); Flog.RayTracer.Color.prototype = { - red : 0.0, - green : 0.0, - blue : 0.0, - - initialize : function(r, g, b) { - if(!r) r = 0.0; - if(!g) g = 0.0; - if(!b) b = 0.0; - - this.red = r; - this.green = g; - this.blue = b; - }, + red: 0.0, + green: 0.0, + blue: 0.0, - add : function(c1, c2){ - var result = new Flog.RayTracer.Color(0,0,0); + initialize: function (r, g, b) { + if (!r) r = 0.0; + if (!g) g = 0.0; + if (!b) b = 0.0; - result.red = c1.red + c2.red; - result.green = c1.green + c2.green; - result.blue = c1.blue + c2.blue; - - return result; - }, + this.red = r; + this.green = g; + this.blue = b; + }, - addScalar: function(c1, s){ - var result = new Flog.RayTracer.Color(0,0,0); + add: function (c1, c2) { + var result = new Flog.RayTracer.Color(0, 0, 0); - result.red = c1.red + s; - result.green = c1.green + s; - result.blue = c1.blue + s; + result.red = c1.red + c2.red; + result.green = c1.green + c2.green; + result.blue = c1.blue + c2.blue; - result.limit(); + return result; + }, - return result; - }, + addScalar: function (c1, s) { + var result = new Flog.RayTracer.Color(0, 0, 0); - subtract: function(c1, c2){ - var result = new Flog.RayTracer.Color(0,0,0); + result.red = c1.red + s; + result.green = c1.green + s; + result.blue = c1.blue + s; - result.red = c1.red - c2.red; - result.green = c1.green - c2.green; - result.blue = c1.blue - c2.blue; + result.limit(); - return result; - }, + return result; + }, - multiply : function(c1, c2) { - var result = new Flog.RayTracer.Color(0,0,0); + subtract: function (c1, c2) { + var result = new Flog.RayTracer.Color(0, 0, 0); - result.red = c1.red * c2.red; - result.green = c1.green * c2.green; - result.blue = c1.blue * c2.blue; + result.red = c1.red - c2.red; + result.green = c1.green - c2.green; + result.blue = c1.blue - c2.blue; - return result; - }, + return result; + }, - multiplyScalar : function(c1, f) { - var result = new Flog.RayTracer.Color(0,0,0); + multiply: function (c1, c2) { + var result = new Flog.RayTracer.Color(0, 0, 0); - result.red = c1.red * f; - result.green = c1.green * f; - result.blue = c1.blue * f; + result.red = c1.red * c2.red; + result.green = c1.green * c2.green; + result.blue = c1.blue * c2.blue; - return result; - }, + return result; + }, - divideFactor : function(c1, f) { - var result = new Flog.RayTracer.Color(0,0,0); + multiplyScalar: function (c1, f) { + var result = new Flog.RayTracer.Color(0, 0, 0); - result.red = c1.red / f; - result.green = c1.green / f; - result.blue = c1.blue / f; + result.red = c1.red * f; + result.green = c1.green * f; + result.blue = c1.blue * f; - return result; - }, + return result; + }, - limit: function(){ - this.red = (this.red > 0.0) ? ( (this.red > 1.0) ? 1.0 : this.red ) : 0.0; - this.green = (this.green > 0.0) ? ( (this.green > 1.0) ? 1.0 : this.green ) : 0.0; - this.blue = (this.blue > 0.0) ? ( (this.blue > 1.0) ? 1.0 : this.blue ) : 0.0; - }, + divideFactor: function (c1, f) { + var result = new Flog.RayTracer.Color(0, 0, 0); - distance : function(color) { - var d = Math.abs(this.red - color.red) + Math.abs(this.green - color.green) + Math.abs(this.blue - color.blue); - return d; - }, + result.red = c1.red / f; + result.green = c1.green / f; + result.blue = c1.blue / f; - blend: function(c1, c2, w){ - var result = new Flog.RayTracer.Color(0,0,0); - result = Flog.RayTracer.Color.prototype.add( - Flog.RayTracer.Color.prototype.multiplyScalar(c1, 1 - w), - Flog.RayTracer.Color.prototype.multiplyScalar(c2, w) - ); - return result; - }, + return result; + }, - brightness : function() { - var r = Math.floor(this.red*255); - var g = Math.floor(this.green*255); - var b = Math.floor(this.blue*255); - return (r * 77 + g * 150 + b * 29) >> 8; - }, + limit: function () { + this.red = this.red > 0.0 ? (this.red > 1.0 ? 1.0 : this.red) : 0.0; + this.green = this.green > 0.0 ? (this.green > 1.0 ? 1.0 : this.green) : 0.0; + this.blue = this.blue > 0.0 ? (this.blue > 1.0 ? 1.0 : this.blue) : 0.0; + }, - toString : function () { - var r = Math.floor(this.red*255); - var g = Math.floor(this.green*255); - var b = Math.floor(this.blue*255); + distance: function (color) { + var d = + Math.abs(this.red - color.red) + + Math.abs(this.green - color.green) + + Math.abs(this.blue - color.blue); + return d; + }, - return "rgb("+ r +","+ g +","+ b +")"; - } -} + blend: function (c1, c2, w) { + var result = new Flog.RayTracer.Color(0, 0, 0); + result = Flog.RayTracer.Color.prototype.add( + Flog.RayTracer.Color.prototype.multiplyScalar(c1, 1 - w), + Flog.RayTracer.Color.prototype.multiplyScalar(c2, w) + ); + return result; + }, + + brightness: function () { + var r = Math.floor(this.red * 255); + var g = Math.floor(this.green * 255); + var b = Math.floor(this.blue * 255); + return (r * 77 + g * 150 + b * 29) >> 8; + }, + + toString: function () { + var r = Math.floor(this.red * 255); + var g = Math.floor(this.green * 255); + var b = Math.floor(this.blue * 255); + + return "rgb(" + r + "," + g + "," + b + ")"; + }, +}; /* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; +if (typeof Flog == "undefined") var Flog = {}; +if (typeof Flog.RayTracer == "undefined") Flog.RayTracer = {}; Flog.RayTracer.Light = Class.create(); Flog.RayTracer.Light.prototype = { - position: null, - color: null, - intensity: 10.0, - - initialize : function(pos, color, intensity) { - this.position = pos; - this.color = color; - this.intensity = (intensity ? intensity : 10.0); - }, - - toString : function () { - return 'Light [' + this.position.x + ',' + this.position.y + ',' + this.position.z + ']'; - } -} + position: null, + color: null, + intensity: 10.0, + + initialize: function (pos, color, intensity) { + this.position = pos; + this.color = color; + this.intensity = intensity ? intensity : 10.0; + }, + + toString: function () { + return ( + "Light [" + + this.position.x + + "," + + this.position.y + + "," + + this.position.z + + "]" + ); + }, +}; /* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; +if (typeof Flog == "undefined") var Flog = {}; +if (typeof Flog.RayTracer == "undefined") Flog.RayTracer = {}; Flog.RayTracer.Vector = Class.create(); Flog.RayTracer.Vector.prototype = { - x : 0.0, - y : 0.0, - z : 0.0, - - initialize : function(x, y, z) { - this.x = (x ? x : 0); - this.y = (y ? y : 0); - this.z = (z ? z : 0); - }, - - copy: function(vector){ - this.x = vector.x; - this.y = vector.y; - this.z = vector.z; - }, - - normalize : function() { - var m = this.magnitude(); - return new Flog.RayTracer.Vector(this.x / m, this.y / m, this.z / m); - }, - - magnitude : function() { - return Math.sqrt((this.x * this.x) + (this.y * this.y) + (this.z * this.z)); - }, + x: 0.0, + y: 0.0, + z: 0.0, + + initialize: function (x, y, z) { + this.x = x ? x : 0; + this.y = y ? y : 0; + this.z = z ? z : 0; + }, + + copy: function (vector) { + this.x = vector.x; + this.y = vector.y; + this.z = vector.z; + }, + + normalize: function () { + var m = this.magnitude(); + return new Flog.RayTracer.Vector(this.x / m, this.y / m, this.z / m); + }, + + magnitude: function () { + return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + }, + + cross: function (w) { + return new Flog.RayTracer.Vector( + -this.z * w.y + this.y * w.z, + this.z * w.x - this.x * w.z, + -this.y * w.x + this.x * w.y + ); + }, - cross : function(w) { - return new Flog.RayTracer.Vector( - -this.z * w.y + this.y * w.z, - this.z * w.x - this.x * w.z, - -this.y * w.x + this.x * w.y); - }, + dot: function (w) { + return this.x * w.x + this.y * w.y + this.z * w.z; + }, - dot : function(w) { - return this.x * w.x + this.y * w.y + this.z * w.z; - }, + add: function (v, w) { + return new Flog.RayTracer.Vector(w.x + v.x, w.y + v.y, w.z + v.z); + }, - add : function(v, w) { - return new Flog.RayTracer.Vector(w.x + v.x, w.y + v.y, w.z + v.z); - }, + subtract: function (v, w) { + if (!w || !v) throw "Vectors must be defined [" + v + "," + w + "]"; + return new Flog.RayTracer.Vector(v.x - w.x, v.y - w.y, v.z - w.z); + }, - subtract : function(v, w) { - if(!w || !v) throw 'Vectors must be defined [' + v + ',' + w + ']'; - return new Flog.RayTracer.Vector(v.x - w.x, v.y - w.y, v.z - w.z); - }, + multiplyVector: function (v, w) { + return new Flog.RayTracer.Vector(v.x * w.x, v.y * w.y, v.z * w.z); + }, - multiplyVector : function(v, w) { - return new Flog.RayTracer.Vector(v.x * w.x, v.y * w.y, v.z * w.z); - }, + multiplyScalar: function (v, w) { + return new Flog.RayTracer.Vector(v.x * w, v.y * w, v.z * w); + }, - multiplyScalar : function(v, w) { - return new Flog.RayTracer.Vector(v.x * w, v.y * w, v.z * w); - }, - - toString : function () { - return 'Vector [' + this.x + ',' + this.y + ',' + this.z + ']'; - } -} + toString: function () { + return "Vector [" + this.x + "," + this.y + "," + this.z + "]"; + }, +}; /* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; +if (typeof Flog == "undefined") var Flog = {}; +if (typeof Flog.RayTracer == "undefined") Flog.RayTracer = {}; Flog.RayTracer.Ray = Class.create(); Flog.RayTracer.Ray.prototype = { - position : null, - direction : null, - initialize : function(pos, dir) { - this.position = pos; - this.direction = dir; - }, - - toString : function () { - return 'Ray [' + this.position + ',' + this.direction + ']'; - } -} + position: null, + direction: null, + initialize: function (pos, dir) { + this.position = pos; + this.direction = dir; + }, + + toString: function () { + return "Ray [" + this.position + "," + this.direction + "]"; + }, +}; /* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; +if (typeof Flog == "undefined") var Flog = {}; +if (typeof Flog.RayTracer == "undefined") Flog.RayTracer = {}; Flog.RayTracer.Scene = Class.create(); Flog.RayTracer.Scene.prototype = { - camera : null, - shapes : [], - lights : [], - background : null, - - initialize : function() { - this.camera = new Flog.RayTracer.Camera( - new Flog.RayTracer.Vector(0,0,-5), - new Flog.RayTracer.Vector(0,0,1), - new Flog.RayTracer.Vector(0,1,0) - ); - this.shapes = new Array(); - this.lights = new Array(); - this.background = new Flog.RayTracer.Background(new Flog.RayTracer.Color(0,0,0.5), 0.2); - } -} + camera: null, + shapes: [], + lights: [], + background: null, + + initialize: function () { + this.camera = new Flog.RayTracer.Camera( + new Flog.RayTracer.Vector(0, 0, -5), + new Flog.RayTracer.Vector(0, 0, 1), + new Flog.RayTracer.Vector(0, 1, 0) + ); + this.shapes = new Array(); + this.lights = new Array(); + this.background = new Flog.RayTracer.Background( + new Flog.RayTracer.Color(0, 0, 0.5), + 0.2 + ); + }, +}; /* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; -if(typeof(Flog.RayTracer.Material) == 'undefined') Flog.RayTracer.Material = {}; +if (typeof Flog == "undefined") var Flog = {}; +if (typeof Flog.RayTracer == "undefined") Flog.RayTracer = {}; +if (typeof Flog.RayTracer.Material == "undefined") Flog.RayTracer.Material = {}; Flog.RayTracer.Material.BaseMaterial = Class.create(); Flog.RayTracer.Material.BaseMaterial.prototype = { - - gloss: 2.0, // [0...infinity] 0 = matt - transparency: 0.0, // 0=opaque - reflection: 0.0, // [0...infinity] 0 = no reflection - refraction: 0.50, - hasTexture: false, - - initialize : function() { - - }, - - getColor: function(u, v){ - - }, - - wrapUp: function(t){ - t = t % 2.0; - if(t < -1) t += 2.0; - if(t >= 1) t -= 2.0; - return t; - }, - - toString : function () { - return 'Material [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; - } -} + gloss: 2.0, // [0...infinity] 0 = matt + transparency: 0.0, // 0=opaque + reflection: 0.0, // [0...infinity] 0 = no reflection + refraction: 0.5, + hasTexture: false, + + initialize: function () {}, + + getColor: function (u, v) {}, + + wrapUp: function (t) { + t = t % 2.0; + if (t < -1) t += 2.0; + if (t >= 1) t -= 2.0; + return t; + }, + + toString: function () { + return ( + "Material [gloss=" + + this.gloss + + ", transparency=" + + this.transparency + + ", hasTexture=" + + this.hasTexture + + "]" + ); + }, +}; /* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; +if (typeof Flog == "undefined") var Flog = {}; +if (typeof Flog.RayTracer == "undefined") Flog.RayTracer = {}; Flog.RayTracer.Material.Solid = Class.create(); Flog.RayTracer.Material.Solid.prototype = Object.extend( - new Flog.RayTracer.Material.BaseMaterial(), { - initialize : function(color, reflection, refraction, transparency, gloss) { - this.color = color; - this.reflection = reflection; - this.transparency = transparency; - this.gloss = gloss; - this.hasTexture = false; - }, - - getColor: function(u, v){ - return this.color; - }, - - toString : function () { - return 'SolidMaterial [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; - } - } + new Flog.RayTracer.Material.BaseMaterial(), + { + initialize: function (color, reflection, refraction, transparency, gloss) { + this.color = color; + this.reflection = reflection; + this.transparency = transparency; + this.gloss = gloss; + this.hasTexture = false; + }, + + getColor: function (u, v) { + return this.color; + }, + + toString: function () { + return ( + "SolidMaterial [gloss=" + + this.gloss + + ", transparency=" + + this.transparency + + ", hasTexture=" + + this.hasTexture + + "]" + ); + }, + } ); /* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; +if (typeof Flog == "undefined") var Flog = {}; +if (typeof Flog.RayTracer == "undefined") Flog.RayTracer = {}; Flog.RayTracer.Material.Chessboard = Class.create(); Flog.RayTracer.Material.Chessboard.prototype = Object.extend( - new Flog.RayTracer.Material.BaseMaterial(), { - colorEven: null, - colorOdd: null, - density: 0.5, - - initialize : function(colorEven, colorOdd, reflection, transparency, gloss, density) { - this.colorEven = colorEven; - this.colorOdd = colorOdd; - this.reflection = reflection; - this.transparency = transparency; - this.gloss = gloss; - this.density = density; - this.hasTexture = true; - }, - - getColor: function(u, v){ - var t = this.wrapUp(u * this.density) * this.wrapUp(v * this.density); - - if(t < 0.0) - return this.colorEven; - else - return this.colorOdd; - }, - - toString : function () { - return 'ChessMaterial [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; - } - } + new Flog.RayTracer.Material.BaseMaterial(), + { + colorEven: null, + colorOdd: null, + density: 0.5, + + initialize: function ( + colorEven, + colorOdd, + reflection, + transparency, + gloss, + density + ) { + this.colorEven = colorEven; + this.colorOdd = colorOdd; + this.reflection = reflection; + this.transparency = transparency; + this.gloss = gloss; + this.density = density; + this.hasTexture = true; + }, + + getColor: function (u, v) { + var t = this.wrapUp(u * this.density) * this.wrapUp(v * this.density); + + if (t < 0.0) return this.colorEven; + else return this.colorOdd; + }, + + toString: function () { + return ( + "ChessMaterial [gloss=" + + this.gloss + + ", transparency=" + + this.transparency + + ", hasTexture=" + + this.hasTexture + + "]" + ); + }, + } ); /* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; -if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; +if (typeof Flog == "undefined") var Flog = {}; +if (typeof Flog.RayTracer == "undefined") Flog.RayTracer = {}; +if (typeof Flog.RayTracer.Shape == "undefined") Flog.RayTracer.Shape = {}; Flog.RayTracer.Shape.Sphere = Class.create(); Flog.RayTracer.Shape.Sphere.prototype = { - initialize : function(pos, radius, material) { - this.radius = radius; - this.position = pos; - this.material = material; - }, - - intersect: function(ray){ - var info = new Flog.RayTracer.IntersectionInfo(); - info.shape = this; - - var dst = Flog.RayTracer.Vector.prototype.subtract(ray.position, this.position); - - var B = dst.dot(ray.direction); - var C = dst.dot(dst) - (this.radius * this.radius); - var D = (B * B) - C; - - if(D > 0){ // intersection! - info.isHit = true; - info.distance = (-B) - Math.sqrt(D); - info.position = Flog.RayTracer.Vector.prototype.add( - ray.position, - Flog.RayTracer.Vector.prototype.multiplyScalar( - ray.direction, - info.distance - ) - ); - info.normal = Flog.RayTracer.Vector.prototype.subtract( - info.position, - this.position - ).normalize(); - - info.color = this.material.getColor(0,0); - } else { - info.isHit = false; - } - return info; - }, + initialize: function (pos, radius, material) { + this.radius = radius; + this.position = pos; + this.material = material; + }, + + intersect: function (ray) { + var info = new Flog.RayTracer.IntersectionInfo(); + info.shape = this; + + var dst = Flog.RayTracer.Vector.prototype.subtract( + ray.position, + this.position + ); - toString : function () { - return 'Sphere [position=' + this.position + ', radius=' + this.radius + ']'; + var B = dst.dot(ray.direction); + var C = dst.dot(dst) - this.radius * this.radius; + var D = B * B - C; + + if (D > 0) { + // intersection! + info.isHit = true; + info.distance = -B - Math.sqrt(D); + info.position = Flog.RayTracer.Vector.prototype.add( + ray.position, + Flog.RayTracer.Vector.prototype.multiplyScalar( + ray.direction, + info.distance + ) + ); + info.normal = Flog.RayTracer.Vector.prototype + .subtract(info.position, this.position) + .normalize(); + + info.color = this.material.getColor(0, 0); + } else { + info.isHit = false; } -} + return info; + }, + + toString: function () { + return ( + "Sphere [position=" + this.position + ", radius=" + this.radius + "]" + ); + }, +}; /* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; -if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; +if (typeof Flog == "undefined") var Flog = {}; +if (typeof Flog.RayTracer == "undefined") Flog.RayTracer = {}; +if (typeof Flog.RayTracer.Shape == "undefined") Flog.RayTracer.Shape = {}; Flog.RayTracer.Shape.Plane = Class.create(); Flog.RayTracer.Shape.Plane.prototype = { - d: 0.0, + d: 0.0, - initialize : function(pos, d, material) { - this.position = pos; - this.d = d; - this.material = material; - }, + initialize: function (pos, d, material) { + this.position = pos; + this.d = d; + this.material = material; + }, - intersect: function(ray){ - var info = new Flog.RayTracer.IntersectionInfo(); - - var Vd = this.position.dot(ray.direction); - if(Vd == 0) return info; // no intersection - - var t = -(this.position.dot(ray.position) + this.d) / Vd; - if(t <= 0) return info; - - info.shape = this; - info.isHit = true; - info.position = Flog.RayTracer.Vector.prototype.add( - ray.position, - Flog.RayTracer.Vector.prototype.multiplyScalar( - ray.direction, - t - ) - ); - info.normal = this.position; - info.distance = t; - - if(this.material.hasTexture){ - var vU = new Flog.RayTracer.Vector(this.position.y, this.position.z, -this.position.x); - var vV = vU.cross(this.position); - var u = info.position.dot(vU); - var v = info.position.dot(vV); - info.color = this.material.getColor(u,v); - } else { - info.color = this.material.getColor(0,0); - } + intersect: function (ray) { + var info = new Flog.RayTracer.IntersectionInfo(); - return info; - }, + var Vd = this.position.dot(ray.direction); + if (Vd == 0) return info; // no intersection - toString : function () { - return 'Plane [' + this.position + ', d=' + this.d + ']'; + var t = -(this.position.dot(ray.position) + this.d) / Vd; + if (t <= 0) return info; + + info.shape = this; + info.isHit = true; + info.position = Flog.RayTracer.Vector.prototype.add( + ray.position, + Flog.RayTracer.Vector.prototype.multiplyScalar(ray.direction, t) + ); + info.normal = this.position; + info.distance = t; + + if (this.material.hasTexture) { + var vU = new Flog.RayTracer.Vector( + this.position.y, + this.position.z, + -this.position.x + ); + var vV = vU.cross(this.position); + var u = info.position.dot(vU); + var v = info.position.dot(vV); + info.color = this.material.getColor(u, v); + } else { + info.color = this.material.getColor(0, 0); } -} + + return info; + }, + + toString: function () { + return "Plane [" + this.position + ", d=" + this.d + "]"; + }, +}; /* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; +if (typeof Flog == "undefined") var Flog = {}; +if (typeof Flog.RayTracer == "undefined") Flog.RayTracer = {}; Flog.RayTracer.IntersectionInfo = Class.create(); Flog.RayTracer.IntersectionInfo.prototype = { - isHit: false, - hitCount: 0, - shape: null, - position: null, - normal: null, - color: null, - distance: null, - - initialize : function() { - this.color = new Flog.RayTracer.Color(0,0,0); - }, - - toString : function () { - return 'Intersection [' + this.position + ']'; - } -} + isHit: false, + hitCount: 0, + shape: null, + position: null, + normal: null, + color: null, + distance: null, + + initialize: function () { + this.color = new Flog.RayTracer.Color(0, 0, 0); + }, + + toString: function () { + return "Intersection [" + this.position + "]"; + }, +}; /* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; +if (typeof Flog == "undefined") var Flog = {}; +if (typeof Flog.RayTracer == "undefined") Flog.RayTracer = {}; Flog.RayTracer.Camera = Class.create(); Flog.RayTracer.Camera.prototype = { - position: null, - lookAt: null, - equator: null, - up: null, - screen: null, - - initialize : function(pos, lookAt, up) { - this.position = pos; - this.lookAt = lookAt; - this.up = up; - this.equator = lookAt.normalize().cross(this.up); - this.screen = Flog.RayTracer.Vector.prototype.add(this.position, this.lookAt); - }, - - getRay: function(vx, vy){ - var pos = Flog.RayTracer.Vector.prototype.subtract( - this.screen, - Flog.RayTracer.Vector.prototype.subtract( - Flog.RayTracer.Vector.prototype.multiplyScalar(this.equator, vx), - Flog.RayTracer.Vector.prototype.multiplyScalar(this.up, vy) - ) - ); - pos.y = pos.y * -1; - var dir = Flog.RayTracer.Vector.prototype.subtract( - pos, - this.position - ); + position: null, + lookAt: null, + equator: null, + up: null, + screen: null, + + initialize: function (pos, lookAt, up) { + this.position = pos; + this.lookAt = lookAt; + this.up = up; + this.equator = lookAt.normalize().cross(this.up); + this.screen = Flog.RayTracer.Vector.prototype.add( + this.position, + this.lookAt + ); + }, + + getRay: function (vx, vy) { + var pos = Flog.RayTracer.Vector.prototype.subtract( + this.screen, + Flog.RayTracer.Vector.prototype.subtract( + Flog.RayTracer.Vector.prototype.multiplyScalar(this.equator, vx), + Flog.RayTracer.Vector.prototype.multiplyScalar(this.up, vy) + ) + ); + pos.y = pos.y * -1; + var dir = Flog.RayTracer.Vector.prototype.subtract(pos, this.position); - var ray = new Flog.RayTracer.Ray(pos, dir.normalize()); + var ray = new Flog.RayTracer.Ray(pos, dir.normalize()); - return ray; - }, + return ray; + }, - toString : function () { - return 'Ray []'; - } -} + toString: function () { + return "Ray []"; + }, +}; /* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; +if (typeof Flog == "undefined") var Flog = {}; +if (typeof Flog.RayTracer == "undefined") Flog.RayTracer = {}; Flog.RayTracer.Background = Class.create(); Flog.RayTracer.Background.prototype = { - color : null, - ambience : 0.0, + color: null, + ambience: 0.0, - initialize : function(color, ambience) { - this.color = color; - this.ambience = ambience; - } -} + initialize: function (color, ambience) { + this.color = color; + this.ambience = ambience; + }, +}; /* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; +if (typeof Flog == "undefined") var Flog = {}; +if (typeof Flog.RayTracer == "undefined") Flog.RayTracer = {}; Flog.RayTracer.Engine = Class.create(); Flog.RayTracer.Engine.prototype = { - canvas: null, /* 2d context we can render to */ - - initialize: function(options){ - this.options = Object.extend({ - canvasHeight: 100, - canvasWidth: 100, - pixelWidth: 2, - pixelHeight: 2, - renderDiffuse: false, - renderShadows: false, - renderHighlights: false, - renderReflections: false, - rayDepth: 2 - }, options || {}); - - this.options.canvasHeight /= this.options.pixelHeight; - this.options.canvasWidth /= this.options.pixelWidth; - - /* TODO: dynamically include other scripts */ - }, + canvas: null /* 2d context we can render to */, + + initialize: function (options) { + this.options = Object.extend( + { + canvasHeight: 100, + canvasWidth: 100, + pixelWidth: 2, + pixelHeight: 2, + renderDiffuse: false, + renderShadows: false, + renderHighlights: false, + renderReflections: false, + rayDepth: 2, + }, + options || {} + ); - setPixel: function(x, y, color){ - var pxW, pxH; - pxW = this.options.pixelWidth; - pxH = this.options.pixelHeight; - - if (this.canvas) { - this.canvas.fillStyle = color.toString(); - this.canvas.fillRect (x * pxW, y * pxH, pxW, pxH); - } else { - if (x === y) { - checkNumber += color.brightness(); - } - // print(x * pxW, y * pxH, pxW, pxH); - } - }, + this.options.canvasHeight /= this.options.pixelHeight; + this.options.canvasWidth /= this.options.pixelWidth; - renderScene: function(scene, canvas){ - checkNumber = 0; - /* Get canvas */ - if (canvas) { - this.canvas = canvas.getContext("2d"); - } else { - this.canvas = null; - } + /* TODO: dynamically include other scripts */ + }, - var canvasHeight = this.options.canvasHeight; - var canvasWidth = this.options.canvasWidth; + setPixel: function (x, y, color) { + var pxW, pxH; + pxW = this.options.pixelWidth; + pxH = this.options.pixelHeight; - for(var y=0; y < canvasHeight; y++){ - for(var x=0; x < canvasWidth; x++){ - var yp = y * 1.0 / canvasHeight * 2 - 1; - var xp = x * 1.0 / canvasWidth * 2 - 1; + if (this.canvas) { + this.canvas.fillStyle = color.toString(); + this.canvas.fillRect(x * pxW, y * pxH, pxW, pxH); + } else { + if (x === y) { + checkNumber += color.brightness(); + } + // print(x * pxW, y * pxH, pxW, pxH); + } + }, + + renderScene: function (scene, canvas) { + checkNumber = 0; + /* Get canvas */ + if (canvas) { + this.canvas = canvas.getContext("2d"); + } else { + this.canvas = null; + } - var ray = scene.camera.getRay(xp, yp); + var canvasHeight = this.options.canvasHeight; + var canvasWidth = this.options.canvasWidth; - var color = this.getPixelColor(ray, scene); + for (var y = 0; y < canvasHeight; y++) { + for (var x = 0; x < canvasWidth; x++) { + var yp = ((y * 1.0) / canvasHeight) * 2 - 1; + var xp = ((x * 1.0) / canvasWidth) * 2 - 1; - this.setPixel(x, y, color); - } + var ray = scene.camera.getRay(xp, yp); + + var color = this.getPixelColor(ray, scene); + + this.setPixel(x, y, color); + } + } + if (checkNumber !== 2321) { + throw new Error("Scene rendered incorrectly"); + } + }, + + getPixelColor: function (ray, scene) { + var info = this.testIntersection(ray, scene, null); + if (info.isHit) { + var color = this.rayTrace(info, ray, scene, 0); + return color; + } + return scene.background.color; + }, + + testIntersection: function (ray, scene, exclude) { + var hits = 0; + var best = new Flog.RayTracer.IntersectionInfo(); + best.distance = 2000; + + for (var i = 0; i < scene.shapes.length; i++) { + var shape = scene.shapes[i]; + + if (shape != exclude) { + var info = shape.intersect(ray); + if (info.isHit && info.distance >= 0 && info.distance < best.distance) { + best = info; + hits++; } - if (checkNumber !== 2321) { - throw new Error("Scene rendered incorrectly"); + } + } + best.hitCount = hits; + return best; + }, + + getReflectionRay: function (P, N, V) { + var c1 = -N.dot(V); + var R1 = Flog.RayTracer.Vector.prototype.add( + Flog.RayTracer.Vector.prototype.multiplyScalar(N, 2 * c1), + V + ); + return new Flog.RayTracer.Ray(P, R1); + }, + + rayTrace: function (info, ray, scene, depth) { + // Calc ambient + var color = Flog.RayTracer.Color.prototype.multiplyScalar( + info.color, + scene.background.ambience + ); + var oldColor = color; + var shininess = Math.pow(10, info.shape.material.gloss + 1); + + for (var i = 0; i < scene.lights.length; i++) { + var light = scene.lights[i]; + + // Calc diffuse lighting + var v = Flog.RayTracer.Vector.prototype + .subtract(light.position, info.position) + .normalize(); + + if (this.options.renderDiffuse) { + var L = v.dot(info.normal); + if (L > 0.0) { + color = Flog.RayTracer.Color.prototype.add( + color, + Flog.RayTracer.Color.prototype.multiply( + info.color, + Flog.RayTracer.Color.prototype.multiplyScalar(light.color, L) + ) + ); } - }, + } - getPixelColor: function(ray, scene){ - var info = this.testIntersection(ray, scene, null); - if(info.isHit){ - var color = this.rayTrace(info, ray, scene, 0); - return color; - } - return scene.background.color; - }, + // The greater the depth the more accurate the colours, but + // this is exponentially (!) expensive + if (depth <= this.options.rayDepth) { + // calculate reflection ray + if ( + this.options.renderReflections && + info.shape.material.reflection > 0 + ) { + var reflectionRay = this.getReflectionRay( + info.position, + info.normal, + ray.direction + ); + var refl = this.testIntersection(reflectionRay, scene, info.shape); + + if (refl.isHit && refl.distance > 0) { + refl.color = this.rayTrace(refl, reflectionRay, scene, depth + 1); + } else { + refl.color = scene.background.color; + } - testIntersection: function(ray, scene, exclude){ - var hits = 0; - var best = new Flog.RayTracer.IntersectionInfo(); - best.distance = 2000; - - for(var i=0; i= 0 && info.distance < best.distance){ - best = info; - hits++; - } - } + color = Flog.RayTracer.Color.prototype.blend( + color, + refl.color, + info.shape.material.reflection + ); } - best.hitCount = hits; - return best; - }, - getReflectionRay: function(P,N,V){ - var c1 = -N.dot(V); - var R1 = Flog.RayTracer.Vector.prototype.add( - Flog.RayTracer.Vector.prototype.multiplyScalar(N, 2*c1), - V - ); - return new Flog.RayTracer.Ray(P, R1); - }, + // Refraction + /* TODO */ + } - rayTrace: function(info, ray, scene, depth){ - // Calc ambient - var color = Flog.RayTracer.Color.prototype.multiplyScalar(info.color, scene.background.ambience); - var oldColor = color; - var shininess = Math.pow(10, info.shape.material.gloss + 1); - - for(var i=0; i 0.0){ - color = Flog.RayTracer.Color.prototype.add( - color, - Flog.RayTracer.Color.prototype.multiply( - info.color, - Flog.RayTracer.Color.prototype.multiplyScalar( - light.color, - L - ) - ) - ); - } - } - - // The greater the depth the more accurate the colours, but - // this is exponentially (!) expensive - if(depth <= this.options.rayDepth){ - // calculate reflection ray - if(this.options.renderReflections && info.shape.material.reflection > 0) - { - var reflectionRay = this.getReflectionRay(info.position, info.normal, ray.direction); - var refl = this.testIntersection(reflectionRay, scene, info.shape); - - if (refl.isHit && refl.distance > 0){ - refl.color = this.rayTrace(refl, reflectionRay, scene, depth + 1); - } else { - refl.color = scene.background.color; - } - - color = Flog.RayTracer.Color.prototype.blend( - color, - refl.color, - info.shape.material.reflection - ); - } + /* Render shadows and highlights */ - // Refraction - /* TODO */ - } + var shadowInfo = new Flog.RayTracer.IntersectionInfo(); - /* Render shadows and highlights */ + if (this.options.renderShadows) { + var shadowRay = new Flog.RayTracer.Ray(info.position, v); - var shadowInfo = new Flog.RayTracer.IntersectionInfo(); + shadowInfo = this.testIntersection(shadowRay, scene, info.shape); + if ( + shadowInfo.isHit && + shadowInfo.shape != info.shape /*&& shadowInfo.shape.type != 'PLANE'*/ + ) { + var vA = Flog.RayTracer.Color.prototype.multiplyScalar(color, 0.5); + var dB = 0.5 * Math.pow(shadowInfo.shape.material.transparency, 0.5); + color = Flog.RayTracer.Color.prototype.addScalar(vA, dB); + } + } - if(this.options.renderShadows){ - var shadowRay = new Flog.RayTracer.Ray(info.position, v); + // Phong specular highlights + if ( + this.options.renderHighlights && + !shadowInfo.isHit && + info.shape.material.gloss > 0 + ) { + var Lv = Flog.RayTracer.Vector.prototype + .subtract(info.shape.position, light.position) + .normalize(); - shadowInfo = this.testIntersection(shadowRay, scene, info.shape); - if(shadowInfo.isHit && shadowInfo.shape != info.shape /*&& shadowInfo.shape.type != 'PLANE'*/){ - var vA = Flog.RayTracer.Color.prototype.multiplyScalar(color, 0.5); - var dB = (0.5 * Math.pow(shadowInfo.shape.material.transparency, 0.5)); - color = Flog.RayTracer.Color.prototype.addScalar(vA,dB); - } - } + var E = Flog.RayTracer.Vector.prototype + .subtract(scene.camera.position, info.shape.position) + .normalize(); - // Phong specular highlights - if(this.options.renderHighlights && !shadowInfo.isHit && info.shape.material.gloss > 0){ - var Lv = Flog.RayTracer.Vector.prototype.subtract( - info.shape.position, - light.position - ).normalize(); - - var E = Flog.RayTracer.Vector.prototype.subtract( - scene.camera.position, - info.shape.position - ).normalize(); - - var H = Flog.RayTracer.Vector.prototype.subtract( - E, - Lv - ).normalize(); + var H = Flog.RayTracer.Vector.prototype.subtract(E, Lv).normalize(); var glossWeight = Math.pow(Math.max(info.normal.dot(H), 0), shininess); color = Flog.RayTracer.Color.prototype.add( - Flog.RayTracer.Color.prototype.multiplyScalar(light.color, glossWeight), - color - ); + Flog.RayTracer.Color.prototype.multiplyScalar( + light.color, + glossWeight + ), + color + ); } - } - color.limit(); - return color; } + color.limit(); + return color; + }, }; - -function renderScene(){ - var scene = new Flog.RayTracer.Scene(); - - scene.camera = new Flog.RayTracer.Camera( - new Flog.RayTracer.Vector(0, 0, -15), - new Flog.RayTracer.Vector(-0.2, 0, 5), - new Flog.RayTracer.Vector(0, 1, 0) - ); - - scene.background = new Flog.RayTracer.Background( - new Flog.RayTracer.Color(0.5, 0.5, 0.5), - 0.4 - ); - - var sphere = new Flog.RayTracer.Shape.Sphere( - new Flog.RayTracer.Vector(-1.5, 1.5, 2), - 1.5, - new Flog.RayTracer.Material.Solid( - new Flog.RayTracer.Color(0,0.5,0.5), - 0.3, - 0.0, - 0.0, - 2.0 - ) - ); - - var sphere1 = new Flog.RayTracer.Shape.Sphere( - new Flog.RayTracer.Vector(1, 0.25, 1), - 0.5, - new Flog.RayTracer.Material.Solid( - new Flog.RayTracer.Color(0.9,0.9,0.9), - 0.1, - 0.0, - 0.0, - 1.5 - ) - ); - - var plane = new Flog.RayTracer.Shape.Plane( - new Flog.RayTracer.Vector(0.1, 0.9, -0.5).normalize(), - 1.2, - new Flog.RayTracer.Material.Chessboard( - new Flog.RayTracer.Color(1,1,1), - new Flog.RayTracer.Color(0,0,0), - 0.2, - 0.0, - 1.0, - 0.7 - ) - ); - - scene.shapes.push(plane); - scene.shapes.push(sphere); - scene.shapes.push(sphere1); - - var light = new Flog.RayTracer.Light( - new Flog.RayTracer.Vector(5, 10, -1), - new Flog.RayTracer.Color(0.8, 0.8, 0.8) - ); - - var light1 = new Flog.RayTracer.Light( - new Flog.RayTracer.Vector(-3, 5, -15), - new Flog.RayTracer.Color(0.8, 0.8, 0.8), - 100 - ); - - scene.lights.push(light); - scene.lights.push(light1); - - var imageWidth = 100; // $F('imageWidth'); - var imageHeight = 100; // $F('imageHeight'); - var pixelSize = "5,5".split(','); // $F('pixelSize').split(','); - var renderDiffuse = true; // $F('renderDiffuse'); - var renderShadows = true; // $F('renderShadows'); - var renderHighlights = true; // $F('renderHighlights'); - var renderReflections = true; // $F('renderReflections'); - var rayDepth = 2;//$F('rayDepth'); - - var raytracer = new Flog.RayTracer.Engine( - { - canvasWidth: imageWidth, - canvasHeight: imageHeight, - pixelWidth: pixelSize[0], - pixelHeight: pixelSize[1], - "renderDiffuse": renderDiffuse, - "renderHighlights": renderHighlights, - "renderShadows": renderShadows, - "renderReflections": renderReflections, - "rayDepth": rayDepth - } - ); - - raytracer.renderScene(scene, null, 0); +function renderScene() { + var scene = new Flog.RayTracer.Scene(); + + scene.camera = new Flog.RayTracer.Camera( + new Flog.RayTracer.Vector(0, 0, -15), + new Flog.RayTracer.Vector(-0.2, 0, 5), + new Flog.RayTracer.Vector(0, 1, 0) + ); + + scene.background = new Flog.RayTracer.Background( + new Flog.RayTracer.Color(0.5, 0.5, 0.5), + 0.4 + ); + + var sphere = new Flog.RayTracer.Shape.Sphere( + new Flog.RayTracer.Vector(-1.5, 1.5, 2), + 1.5, + new Flog.RayTracer.Material.Solid( + new Flog.RayTracer.Color(0, 0.5, 0.5), + 0.3, + 0.0, + 0.0, + 2.0 + ) + ); + + var sphere1 = new Flog.RayTracer.Shape.Sphere( + new Flog.RayTracer.Vector(1, 0.25, 1), + 0.5, + new Flog.RayTracer.Material.Solid( + new Flog.RayTracer.Color(0.9, 0.9, 0.9), + 0.1, + 0.0, + 0.0, + 1.5 + ) + ); + + var plane = new Flog.RayTracer.Shape.Plane( + new Flog.RayTracer.Vector(0.1, 0.9, -0.5).normalize(), + 1.2, + new Flog.RayTracer.Material.Chessboard( + new Flog.RayTracer.Color(1, 1, 1), + new Flog.RayTracer.Color(0, 0, 0), + 0.2, + 0.0, + 1.0, + 0.7 + ) + ); + + scene.shapes.push(plane); + scene.shapes.push(sphere); + scene.shapes.push(sphere1); + + var light = new Flog.RayTracer.Light( + new Flog.RayTracer.Vector(5, 10, -1), + new Flog.RayTracer.Color(0.8, 0.8, 0.8) + ); + + var light1 = new Flog.RayTracer.Light( + new Flog.RayTracer.Vector(-3, 5, -15), + new Flog.RayTracer.Color(0.8, 0.8, 0.8), + 100 + ); + + scene.lights.push(light); + scene.lights.push(light1); + + var imageWidth = 100; // $F('imageWidth'); + var imageHeight = 100; // $F('imageHeight'); + var pixelSize = "5,5".split(","); // $F('pixelSize').split(','); + var renderDiffuse = true; // $F('renderDiffuse'); + var renderShadows = true; // $F('renderShadows'); + var renderHighlights = true; // $F('renderHighlights'); + var renderReflections = true; // $F('renderReflections'); + var rayDepth = 2; //$F('rayDepth'); + + var raytracer = new Flog.RayTracer.Engine({ + canvasWidth: imageWidth, + canvasHeight: imageHeight, + pixelWidth: pixelSize[0], + pixelHeight: pixelSize[1], + renderDiffuse: renderDiffuse, + renderHighlights: renderHighlights, + renderShadows: renderShadows, + renderReflections: renderReflections, + rayDepth: rayDepth, + }); + + raytracer.renderScene(scene, null, 0); } diff --git a/benchmarks/v8-v7/regexp.js b/benchmarks/v8-v7/regexp.js index 9c83142266..d5ecb65226 100644 --- a/benchmarks/v8-v7/regexp.js +++ b/benchmarks/v8-v7/regexp.js @@ -36,9 +36,8 @@ // affect how the regexps match their input. Finally the strings are // scrambled to exercise the regexp engine on different input strings. - -var RegExp = new BenchmarkSuite('RegExp', 910985, [ - new Benchmark("RegExp", RegExpRun, RegExpSetup, RegExpTearDown) +var RegExp = new BenchmarkSuite("RegExp", 910985, [ + new Benchmark("RegExp", RegExpRun, RegExpSetup, RegExpTearDown), ]); var regExpBenchmark = null; @@ -60,11 +59,14 @@ function RegExpTearDown() { // The variants are computed by randomly rotating one random // character. function computeInputVariants(str, n) { - var variants = [ str ]; + var variants = [str]; for (var i = 1; i < n; i++) { var pos = Math.floor(Math.random() * str.length); - var chr = String.fromCharCode((str.charCodeAt(pos) + Math.floor(Math.random() * 128)) % 128); - variants[i] = str.substring(0, pos) + chr + str.substring(pos + 1, str.length); + var chr = String.fromCharCode( + (str.charCodeAt(pos) + Math.floor(Math.random() * 128)) % 128 + ); + variants[i] = + str.substring(0, pos) + chr + str.substring(pos + 1, str.length); } return variants; } @@ -80,42 +82,49 @@ function RegExpBenchmark() { var re7 = /(\d*)(\D*)/g; var re8 = /=/; var re9 = /(^|\s)lhv\-h(\s|$)/; - var str0 = 'Zbmvyyn/5.0 (Jvaqbjf; H; Jvaqbjf AG 5.1; ra-HF) NccyrJroXvg/528.9 (XUGZY, yvxr Trpxb) Puebzr/2.0.157.0 Fnsnev/528.9'; + var str0 = + "Zbmvyyn/5.0 (Jvaqbjf; H; Jvaqbjf AG 5.1; ra-HF) NccyrJroXvg/528.9 (XUGZY, yvxr Trpxb) Puebzr/2.0.157.0 Fnsnev/528.9"; var re10 = /\#/g; var re11 = /\./g; var re12 = /'/g; var re13 = /\?[\w\W]*(sevraqvq|punaaryvq|tebhcvq)=([^\&\?#]*)/i; - var str1 = 'Fubpxjnir Synfu 9.0 e115'; + var str1 = "Fubpxjnir Synfu 9.0 e115"; var re14 = /\s+/g; var re15 = /^\s*(\S*(\s+\S+)*)\s*$/; var re16 = /(-[a-z])/i; - var s0 = computeInputVariants('pyvpx', 6511); - var s1 = computeInputVariants('uggc://jjj.snprobbx.pbz/ybtva.cuc', 1844); - var s2 = computeInputVariants('QBZPbageby_cynprubyqre', 739); - var s3 = computeInputVariants('uggc://jjj.snprobbx.pbz/', 598); - var s4 = computeInputVariants('uggc://jjj.snprobbx.pbz/fepu.cuc', 454); - var s5 = computeInputVariants('qqqq, ZZZ q, llll', 352); - var s6 = computeInputVariants('vachggrkg QBZPbageby_cynprubyqre', 312); - var s7 = computeInputVariants('/ZlFcnprUbzrcntr/Vaqrk-FvgrUbzr,10000000', 282); - var s8 = computeInputVariants('vachggrkg', 177); - var s9 = computeInputVariants('528.9', 170); - var s10 = computeInputVariants('528', 170); - var s11 = computeInputVariants('VCPhygher=ra-HF', 156); - var s12 = computeInputVariants('CersreerqPhygher=ra-HF', 156); - var s13 = computeInputVariants('xrlcerff', 144); - var s14 = computeInputVariants('521', 139); + var s0 = computeInputVariants("pyvpx", 6511); + var s1 = computeInputVariants("uggc://jjj.snprobbx.pbz/ybtva.cuc", 1844); + var s2 = computeInputVariants("QBZPbageby_cynprubyqre", 739); + var s3 = computeInputVariants("uggc://jjj.snprobbx.pbz/", 598); + var s4 = computeInputVariants("uggc://jjj.snprobbx.pbz/fepu.cuc", 454); + var s5 = computeInputVariants("qqqq, ZZZ q, llll", 352); + var s6 = computeInputVariants("vachggrkg QBZPbageby_cynprubyqre", 312); + var s7 = computeInputVariants( + "/ZlFcnprUbzrcntr/Vaqrk-FvgrUbzr,10000000", + 282 + ); + var s8 = computeInputVariants("vachggrkg", 177); + var s9 = computeInputVariants("528.9", 170); + var s10 = computeInputVariants("528", 170); + var s11 = computeInputVariants("VCPhygher=ra-HF", 156); + var s12 = computeInputVariants("CersreerqPhygher=ra-HF", 156); + var s13 = computeInputVariants("xrlcerff", 144); + var s14 = computeInputVariants("521", 139); var s15 = computeInputVariants(str0, 139); - var s16 = computeInputVariants('qvi .so_zrah', 137); - var s17 = computeInputVariants('qvi.so_zrah', 137); - var s18 = computeInputVariants('uvqqra_ryrz', 117); - var s19 = computeInputVariants('sevraqfgre_naba=nvq%3Qn6ss9p85n868ro9s059pn854735956o3%26ers%3Q%26df%3Q%26vpgl%3QHF', 95); - var s20 = computeInputVariants('uggc://ubzr.zlfcnpr.pbz/vaqrk.psz', 93); + var s16 = computeInputVariants("qvi .so_zrah", 137); + var s17 = computeInputVariants("qvi.so_zrah", 137); + var s18 = computeInputVariants("uvqqra_ryrz", 117); + var s19 = computeInputVariants( + "sevraqfgre_naba=nvq%3Qn6ss9p85n868ro9s059pn854735956o3%26ers%3Q%26df%3Q%26vpgl%3QHF", + 95 + ); + var s20 = computeInputVariants("uggc://ubzr.zlfcnpr.pbz/vaqrk.psz", 93); var s21 = computeInputVariants(str1, 92); - var s22 = computeInputVariants('svefg', 85); - var s23 = computeInputVariants('uggc://cebsvyr.zlfcnpr.pbz/vaqrk.psz', 85); - var s24 = computeInputVariants('ynfg', 85); - var s25 = computeInputVariants('qvfcynl', 85); + var s22 = computeInputVariants("svefg", 85); + var s23 = computeInputVariants("uggc://cebsvyr.zlfcnpr.pbz/vaqrk.psz", 85); + var s24 = computeInputVariants("ynfg", 85); + var s25 = computeInputVariants("qvfcynl", 85); function runBlock0() { for (var i = 0; i < 6511; i++) { @@ -125,7 +134,7 @@ function RegExpBenchmark() { re1.exec(s1[i]); } for (var i = 0; i < 739; i++) { - s2[i].replace(re2, ''); + s2[i].replace(re2, ""); } for (var i = 0; i < 598; i++) { re1.exec(s3[i]); @@ -134,7 +143,9 @@ function RegExpBenchmark() { re1.exec(s4[i]); } for (var i = 0; i < 352; i++) { - /qqqq|qqq|qq|q|ZZZZ|ZZZ|ZZ|Z|llll|ll|l|uu|u|UU|U|zz|z|ff|f|gg|g|sss|ss|s|mmm|mm|m/g.exec(s5[i]); + /qqqq|qqq|qq|q|ZZZZ|ZZZ|ZZ|Z|llll|ll|l|uu|u|UU|U|zz|z|ff|f|gg|g|sss|ss|s|mmm|mm|m/g.exec( + s5[i] + ); } for (var i = 0; i < 312; i++) { re3.exec(s6[i]); @@ -143,10 +154,10 @@ function RegExpBenchmark() { re4.exec(s7[i]); } for (var i = 0; i < 177; i++) { - s8[i].replace(re5, ''); + s8[i].replace(re5, ""); } for (var i = 0; i < 170; i++) { - s9[i].replace(re6, ''); + s9[i].replace(re6, ""); re7.exec(s10[i]); } for (var i = 0; i < 156; i++) { @@ -157,95 +168,111 @@ function RegExpBenchmark() { re0.exec(s13[i]); } for (var i = 0; i < 139; i++) { - s14[i].replace(re6, ''); + s14[i].replace(re6, ""); re7.exec(s14[i]); - re9.exec(''); + re9.exec(""); /JroXvg\/(\S+)/.exec(s15[i]); } for (var i = 0; i < 137; i++) { - s16[i].replace(re10, ''); - s16[i].replace(/\[/g, ''); - s17[i].replace(re11, ''); + s16[i].replace(re10, ""); + s16[i].replace(/\[/g, ""); + s17[i].replace(re11, ""); } for (var i = 0; i < 117; i++) { - s18[i].replace(re2, ''); + s18[i].replace(re2, ""); } for (var i = 0; i < 95; i++) { /(?:^|;)\s*sevraqfgre_ynat=([^;]*)/.exec(s19[i]); } for (var i = 0; i < 93; i++) { - s20[i].replace(re12, ''); + s20[i].replace(re12, ""); re13.exec(s20[i]); } for (var i = 0; i < 92; i++) { - s21[i].replace(/([a-zA-Z]|\s)+/, ''); + s21[i].replace(/([a-zA-Z]|\s)+/, ""); } for (var i = 0; i < 85; i++) { - s22[i].replace(re14, ''); - s22[i].replace(re15, ''); - s23[i].replace(re12, ''); - s24[i].replace(re14, ''); - s24[i].replace(re15, ''); + s22[i].replace(re14, ""); + s22[i].replace(re15, ""); + s23[i].replace(re12, ""); + s24[i].replace(re14, ""); + s24[i].replace(re15, ""); re16.exec(s25[i]); re13.exec(s23[i]); } } var re17 = /(^|[^\\])\"\\\/Qngr\((-?[0-9]+)\)\\\/\"/g; - var str2 = '{"anzr":"","ahzoreSbezng":{"PheeraplQrpvznyQvtvgf":2,"PheeraplQrpvznyFrcnengbe":".","VfErnqBayl":gehr,"PheeraplTebhcFvmrf":[3],"AhzoreTebhcFvmrf":[3],"CrepragTebhcFvmrf":[3],"PheeraplTebhcFrcnengbe":",","PheeraplFlzoby":"\xa4","AnAFlzoby":"AnA","PheeraplArtngvirCnggrea":0,"AhzoreArtngvirCnggrea":1,"CrepragCbfvgvirCnggrea":0,"CrepragArtngvirCnggrea":0,"ArtngvirVasvavglFlzoby":"-Vasvavgl","ArtngvirFvta":"-","AhzoreQrpvznyQvtvgf":2,"AhzoreQrpvznyFrcnengbe":".","AhzoreTebhcFrcnengbe":",","PheeraplCbfvgvirCnggrea":0,"CbfvgvirVasvavglFlzoby":"Vasvavgl","CbfvgvirFvta":"+","CrepragQrpvznyQvtvgf":2,"CrepragQrpvznyFrcnengbe":".","CrepragTebhcFrcnengbe":",","CrepragFlzoby":"%","CreZvyyrFlzoby":"\u2030","AngvirQvtvgf":["0","1","2","3","4","5","6","7","8","9"],"QvtvgFhofgvghgvba":1},"qngrGvzrSbezng":{"NZQrfvtangbe":"NZ","Pnyraqne":{"ZvaFhccbegrqQngrGvzr":"@-62135568000000@","ZnkFhccbegrqQngrGvzr":"@253402300799999@","NytbevguzGlcr":1,"PnyraqneGlcr":1,"Renf":[1],"GjbQvtvgLrneZnk":2029,"VfErnqBayl":gehr},"QngrFrcnengbe":"/","SvefgQnlBsJrrx":0,"PnyraqneJrrxEhyr":0,"ShyyQngrGvzrCnggrea":"qqqq, qq ZZZZ llll UU:zz:ff","YbatQngrCnggrea":"qqqq, qq ZZZZ llll","YbatGvzrCnggrea":"UU:zz:ff","ZbaguQnlCnggrea":"ZZZZ qq","CZQrfvtangbe":"CZ","ESP1123Cnggrea":"qqq, qq ZZZ llll UU\':\'zz\':\'ff \'TZG\'","FubegQngrCnggrea":"ZZ/qq/llll","FubegGvzrCnggrea":"UU:zz","FbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq\'G\'UU\':\'zz\':\'ff","GvzrFrcnengbe":":","HavirefnyFbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq UU\':\'zz\':\'ff\'M\'","LrneZbaguCnggrea":"llll ZZZZ","NooerivngrqQnlAnzrf":["Fha","Zba","Ghr","Jrq","Guh","Sev","Fng"],"FubegrfgQnlAnzrf":["Fh","Zb","Gh","Jr","Gu","Se","Fn"],"QnlAnzrf":["Fhaqnl","Zbaqnl","Ghrfqnl","Jrqarfqnl","Guhefqnl","Sevqnl","Fngheqnl"],"NooerivngrqZbaguAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""],"VfErnqBayl":gehr,"AngvirPnyraqneAnzr":"Tertbevna Pnyraqne","NooerivngrqZbaguTravgvirAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguTravgvirAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""]}}'; - var str3 = '{"anzr":"ra-HF","ahzoreSbezng":{"PheeraplQrpvznyQvtvgf":2,"PheeraplQrpvznyFrcnengbe":".","VfErnqBayl":snyfr,"PheeraplTebhcFvmrf":[3],"AhzoreTebhcFvmrf":[3],"CrepragTebhcFvmrf":[3],"PheeraplTebhcFrcnengbe":",","PheeraplFlzoby":"$","AnAFlzoby":"AnA","PheeraplArtngvirCnggrea":0,"AhzoreArtngvirCnggrea":1,"CrepragCbfvgvirCnggrea":0,"CrepragArtngvirCnggrea":0,"ArtngvirVasvavglFlzoby":"-Vasvavgl","ArtngvirFvta":"-","AhzoreQrpvznyQvtvgf":2,"AhzoreQrpvznyFrcnengbe":".","AhzoreTebhcFrcnengbe":",","PheeraplCbfvgvirCnggrea":0,"CbfvgvirVasvavglFlzoby":"Vasvavgl","CbfvgvirFvta":"+","CrepragQrpvznyQvtvgf":2,"CrepragQrpvznyFrcnengbe":".","CrepragTebhcFrcnengbe":",","CrepragFlzoby":"%","CreZvyyrFlzoby":"\u2030","AngvirQvtvgf":["0","1","2","3","4","5","6","7","8","9"],"QvtvgFhofgvghgvba":1},"qngrGvzrSbezng":{"NZQrfvtangbe":"NZ","Pnyraqne":{"ZvaFhccbegrqQngrGvzr":"@-62135568000000@","ZnkFhccbegrqQngrGvzr":"@253402300799999@","NytbevguzGlcr":1,"PnyraqneGlcr":1,"Renf":[1],"GjbQvtvgLrneZnk":2029,"VfErnqBayl":snyfr},"QngrFrcnengbe":"/","SvefgQnlBsJrrx":0,"PnyraqneJrrxEhyr":0,"ShyyQngrGvzrCnggrea":"qqqq, ZZZZ qq, llll u:zz:ff gg","YbatQngrCnggrea":"qqqq, ZZZZ qq, llll","YbatGvzrCnggrea":"u:zz:ff gg","ZbaguQnlCnggrea":"ZZZZ qq","CZQrfvtangbe":"CZ","ESP1123Cnggrea":"qqq, qq ZZZ llll UU\':\'zz\':\'ff \'TZG\'","FubegQngrCnggrea":"Z/q/llll","FubegGvzrCnggrea":"u:zz gg","FbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq\'G\'UU\':\'zz\':\'ff","GvzrFrcnengbe":":","HavirefnyFbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq UU\':\'zz\':\'ff\'M\'","LrneZbaguCnggrea":"ZZZZ, llll","NooerivngrqQnlAnzrf":["Fha","Zba","Ghr","Jrq","Guh","Sev","Fng"],"FubegrfgQnlAnzrf":["Fh","Zb","Gh","Jr","Gu","Se","Fn"],"QnlAnzrf":["Fhaqnl","Zbaqnl","Ghrfqnl","Jrqarfqnl","Guhefqnl","Sevqnl","Fngheqnl"],"NooerivngrqZbaguAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""],"VfErnqBayl":snyfr,"AngvirPnyraqneAnzr":"Tertbevna Pnyraqne","NooerivngrqZbaguTravgvirAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguTravgvirAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""]}}'; - var str4 = 'HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str5 = 'HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var str2 = + '{"anzr":"","ahzoreSbezng":{"PheeraplQrpvznyQvtvgf":2,"PheeraplQrpvznyFrcnengbe":".","VfErnqBayl":gehr,"PheeraplTebhcFvmrf":[3],"AhzoreTebhcFvmrf":[3],"CrepragTebhcFvmrf":[3],"PheeraplTebhcFrcnengbe":",","PheeraplFlzoby":"\xa4","AnAFlzoby":"AnA","PheeraplArtngvirCnggrea":0,"AhzoreArtngvirCnggrea":1,"CrepragCbfvgvirCnggrea":0,"CrepragArtngvirCnggrea":0,"ArtngvirVasvavglFlzoby":"-Vasvavgl","ArtngvirFvta":"-","AhzoreQrpvznyQvtvgf":2,"AhzoreQrpvznyFrcnengbe":".","AhzoreTebhcFrcnengbe":",","PheeraplCbfvgvirCnggrea":0,"CbfvgvirVasvavglFlzoby":"Vasvavgl","CbfvgvirFvta":"+","CrepragQrpvznyQvtvgf":2,"CrepragQrpvznyFrcnengbe":".","CrepragTebhcFrcnengbe":",","CrepragFlzoby":"%","CreZvyyrFlzoby":"\u2030","AngvirQvtvgf":["0","1","2","3","4","5","6","7","8","9"],"QvtvgFhofgvghgvba":1},"qngrGvzrSbezng":{"NZQrfvtangbe":"NZ","Pnyraqne":{"ZvaFhccbegrqQngrGvzr":"@-62135568000000@","ZnkFhccbegrqQngrGvzr":"@253402300799999@","NytbevguzGlcr":1,"PnyraqneGlcr":1,"Renf":[1],"GjbQvtvgLrneZnk":2029,"VfErnqBayl":gehr},"QngrFrcnengbe":"/","SvefgQnlBsJrrx":0,"PnyraqneJrrxEhyr":0,"ShyyQngrGvzrCnggrea":"qqqq, qq ZZZZ llll UU:zz:ff","YbatQngrCnggrea":"qqqq, qq ZZZZ llll","YbatGvzrCnggrea":"UU:zz:ff","ZbaguQnlCnggrea":"ZZZZ qq","CZQrfvtangbe":"CZ","ESP1123Cnggrea":"qqq, qq ZZZ llll UU\':\'zz\':\'ff \'TZG\'","FubegQngrCnggrea":"ZZ/qq/llll","FubegGvzrCnggrea":"UU:zz","FbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq\'G\'UU\':\'zz\':\'ff","GvzrFrcnengbe":":","HavirefnyFbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq UU\':\'zz\':\'ff\'M\'","LrneZbaguCnggrea":"llll ZZZZ","NooerivngrqQnlAnzrf":["Fha","Zba","Ghr","Jrq","Guh","Sev","Fng"],"FubegrfgQnlAnzrf":["Fh","Zb","Gh","Jr","Gu","Se","Fn"],"QnlAnzrf":["Fhaqnl","Zbaqnl","Ghrfqnl","Jrqarfqnl","Guhefqnl","Sevqnl","Fngheqnl"],"NooerivngrqZbaguAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""],"VfErnqBayl":gehr,"AngvirPnyraqneAnzr":"Tertbevna Pnyraqne","NooerivngrqZbaguTravgvirAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguTravgvirAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""]}}'; + var str3 = + '{"anzr":"ra-HF","ahzoreSbezng":{"PheeraplQrpvznyQvtvgf":2,"PheeraplQrpvznyFrcnengbe":".","VfErnqBayl":snyfr,"PheeraplTebhcFvmrf":[3],"AhzoreTebhcFvmrf":[3],"CrepragTebhcFvmrf":[3],"PheeraplTebhcFrcnengbe":",","PheeraplFlzoby":"$","AnAFlzoby":"AnA","PheeraplArtngvirCnggrea":0,"AhzoreArtngvirCnggrea":1,"CrepragCbfvgvirCnggrea":0,"CrepragArtngvirCnggrea":0,"ArtngvirVasvavglFlzoby":"-Vasvavgl","ArtngvirFvta":"-","AhzoreQrpvznyQvtvgf":2,"AhzoreQrpvznyFrcnengbe":".","AhzoreTebhcFrcnengbe":",","PheeraplCbfvgvirCnggrea":0,"CbfvgvirVasvavglFlzoby":"Vasvavgl","CbfvgvirFvta":"+","CrepragQrpvznyQvtvgf":2,"CrepragQrpvznyFrcnengbe":".","CrepragTebhcFrcnengbe":",","CrepragFlzoby":"%","CreZvyyrFlzoby":"\u2030","AngvirQvtvgf":["0","1","2","3","4","5","6","7","8","9"],"QvtvgFhofgvghgvba":1},"qngrGvzrSbezng":{"NZQrfvtangbe":"NZ","Pnyraqne":{"ZvaFhccbegrqQngrGvzr":"@-62135568000000@","ZnkFhccbegrqQngrGvzr":"@253402300799999@","NytbevguzGlcr":1,"PnyraqneGlcr":1,"Renf":[1],"GjbQvtvgLrneZnk":2029,"VfErnqBayl":snyfr},"QngrFrcnengbe":"/","SvefgQnlBsJrrx":0,"PnyraqneJrrxEhyr":0,"ShyyQngrGvzrCnggrea":"qqqq, ZZZZ qq, llll u:zz:ff gg","YbatQngrCnggrea":"qqqq, ZZZZ qq, llll","YbatGvzrCnggrea":"u:zz:ff gg","ZbaguQnlCnggrea":"ZZZZ qq","CZQrfvtangbe":"CZ","ESP1123Cnggrea":"qqq, qq ZZZ llll UU\':\'zz\':\'ff \'TZG\'","FubegQngrCnggrea":"Z/q/llll","FubegGvzrCnggrea":"u:zz gg","FbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq\'G\'UU\':\'zz\':\'ff","GvzrFrcnengbe":":","HavirefnyFbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq UU\':\'zz\':\'ff\'M\'","LrneZbaguCnggrea":"ZZZZ, llll","NooerivngrqQnlAnzrf":["Fha","Zba","Ghr","Jrq","Guh","Sev","Fng"],"FubegrfgQnlAnzrf":["Fh","Zb","Gh","Jr","Gu","Se","Fn"],"QnlAnzrf":["Fhaqnl","Zbaqnl","Ghrfqnl","Jrqarfqnl","Guhefqnl","Sevqnl","Fngheqnl"],"NooerivngrqZbaguAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""],"VfErnqBayl":snyfr,"AngvirPnyraqneAnzr":"Tertbevna Pnyraqne","NooerivngrqZbaguTravgvirAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguTravgvirAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""]}}'; + var str4 = + "HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str5 = + "HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R="; var re18 = /^\s+|\s+$/g; - var str6 = 'uggc://jjj.snprobbx.pbz/vaqrk.cuc'; + var str6 = "uggc://jjj.snprobbx.pbz/vaqrk.cuc"; var re19 = /(?:^|\s+)ba(?:\s+|$)/; var re20 = /[+, ]/; var re21 = /ybnqrq|pbzcyrgr/; - var str7 = ';;jvaqbj.IjPurpxZbhfrCbfvgvbaNQ_VQ=shapgvba(r){vs(!r)ine r=jvaqbj.rirag;ine c=-1;vs(d1)c=d1.EbyybssCnary;ine bo=IjTrgBow("IjCnayNQ_VQ_"+c);vs(bo&&bo.fglyr.ivfvovyvgl=="ivfvoyr"){ine fns=IjFns?8:0;ine pheK=r.pyvragK+IjBOFpe("U")+fns,pheL=r.pyvragL+IjBOFpe("I")+fns;ine y=IjBOEC(NQ_VQ,bo,"Y"),g=IjBOEC(NQ_VQ,bo,"G");ine e=y+d1.Cnaryf[c].Jvqgu,o=g+d1.Cnaryf[c].Urvtug;vs((pheKe)||(pheLo)){vs(jvaqbj.IjBaEbyybssNQ_VQ)IjBaEbyybssNQ_VQ(c);ryfr IjPybfrNq(NQ_VQ,c,gehr,"");}ryfr erghea;}IjPnapryZbhfrYvfgrareNQ_VQ();};;jvaqbj.IjFrgEbyybssCnaryNQ_VQ=shapgvba(c){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;c=IjTc(NQ_VQ,c);vs(d1&&d1.EbyybssCnary>-1)IjPnapryZbhfrYvfgrareNQ_VQ();vs(d1)d1.EbyybssCnary=c;gel{vs(q.nqqRiragYvfgrare)q.nqqRiragYvfgrare(z,s,snyfr);ryfr vs(q.nggnpuRirag)q.nggnpuRirag("ba"+z,s);}pngpu(r){}};;jvaqbj.IjPnapryZbhfrYvfgrareNQ_VQ=shapgvba(){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;vs(d1)d1.EbyybssCnary=-1;gel{vs(q.erzbirRiragYvfgrare)q.erzbirRiragYvfgrare(z,s,snyfr);ryfr vs(q.qrgnpuRirag)q.qrgnpuRirag("ba"+z,s);}pngpu(r){}};;d1.IjTc=d2(n,c){ine nq=d1;vs(vfAnA(c)){sbe(ine v=0;v0){vs(nq.FzV.yratgu>0)nq.FzV+="/";nq.FzV+=vh[v];nq.FtZ[nq.FtZ.yratgu]=snyfr;}}};;d1.IjYvzvg0=d2(n,f){ine nq=d1,vh=f.fcyvg("/");sbe(ine v=0;v0){vs(nq.OvC.yratgu>0)nq.OvC+="/";nq.OvC+=vh[v];}}};;d1.IjRVST=d2(n,c){jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]=IjTrgBow("IjCnayNQ_VQ_"+c+"_Bow");vs(jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]==ahyy)frgGvzrbhg("IjRVST(NQ_VQ,"+c+")",d1.rvsg);};;d1.IjNavzSHC=d2(n,c){ine nq=d1;vs(c>nq.Cnaryf.yratgu)erghea;ine cna=nq.Cnaryf[c],nn=gehr,on=gehr,yn=gehr,en=gehr,cn=nq.Cnaryf[0],sf=nq.ShF,j=cn.Jvqgu,u=cn.Urvtug;vs(j=="100%"){j=sf;en=snyfr;yn=snyfr;}vs(u=="100%"){u=sf;nn=snyfr;on=snyfr;}vs(cn.YnY=="Y")yn=snyfr;vs(cn.YnY=="E")en=snyfr;vs(cn.GnY=="G")nn=snyfr;vs(cn.GnY=="O")on=snyfr;ine k=0,l=0;fjvgpu(nq.NshP%8){pnfr 0:oernx;pnfr 1:vs(nn)l=-sf;oernx;pnfr 2:k=j-sf;oernx;pnfr 3:vs(en)k=j;oernx;pnfr 4:k=j-sf;l=u-sf;oernx;pnfr 5:k=j-sf;vs(on)l=u;oernx;pnfr 6:l=u-sf;oernx;pnfr 7:vs(yn)k=-sf;l=u-sf;oernx;}vs(nq.NshP++ 0)||(nethzragf.yratgu==3&&bG>0))){pyrneGvzrbhg(cay.UgU);cay.UgU=frgGvzrbhg(cay.UvqrNpgvba,(nethzragf.yratgu==3?bG:cay.UvqrGvzrbhgInyhr));}};;d1.IjErfrgGvzrbhg=d2(n,c,bG){c=IjTc(n,c);IjPnapryGvzrbhg(n,c);riny("IjFgnegGvzrbhg(NQ_VQ,c"+(nethzragf.yratgu==3?",bG":"")+")");};;d1.IjErfrgNyyGvzrbhgf=d2(n){sbe(ine c=0;ce)||(pheLo)){vs(jvaqbj.IjBaEbyybssNQ_VQ)IjBaEbyybssNQ_VQ(c);ryfr IjPybfrNq(NQ_VQ,c,gehr,"");}ryfr erghea;}IjPnapryZbhfrYvfgrareNQ_VQ();};;jvaqbj.IjFrgEbyybssCnaryNQ_VQ=shapgvba(c){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;c=IjTc(NQ_VQ,c);vs(d1&&d1.EbyybssCnary>-1)IjPnapryZbhfrYvfgrareNQ_VQ();vs(d1)d1.EbyybssCnary=c;gel{vs(q.nqqRiragYvfgrare)q.nqqRiragYvfgrare(z,s,snyfr);ryfr vs(q.nggnpuRirag)q.nggnpuRirag("ba"+z,s);}pngpu(r){}};;jvaqbj.IjPnapryZbhfrYvfgrareNQ_VQ=shapgvba(){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;vs(d1)d1.EbyybssCnary=-1;gel{vs(q.erzbirRiragYvfgrare)q.erzbirRiragYvfgrare(z,s,snyfr);ryfr vs(q.qrgnpuRirag)q.qrgnpuRirag("ba"+z,s);}pngpu(r){}};;d1.IjTc=d2(n,c){ine nq=d1;vs(vfAnA(c)){sbe(ine v=0;v0){vs(nq.FzV.yratgu>0)nq.FzV+="/";nq.FzV+=vh[v];nq.FtZ[nq.FtZ.yratgu]=snyfr;}}};;d1.IjYvzvg0=d2(n,f){ine nq=d1,vh=f.fcyvg("/");sbe(ine v=0;v0){vs(nq.OvC.yratgu>0)nq.OvC+="/";nq.OvC+=vh[v];}}};;d1.IjRVST=d2(n,c){jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]=IjTrgBow("IjCnayNQ_VQ_"+c+"_Bow");vs(jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]==ahyy)frgGvzrbhg("IjRVST(NQ_VQ,"+c+")",d1.rvsg);};;d1.IjNavzSHC=d2(n,c){ine nq=d1;vs(c>nq.Cnaryf.yratgu)erghea;ine cna=nq.Cnaryf[c],nn=gehr,on=gehr,yn=gehr,en=gehr,cn=nq.Cnaryf[0],sf=nq.ShF,j=cn.Jvqgu,u=cn.Urvtug;vs(j=="100%"){j=sf;en=snyfr;yn=snyfr;}vs(u=="100%"){u=sf;nn=snyfr;on=snyfr;}vs(cn.YnY=="Y")yn=snyfr;vs(cn.YnY=="E")en=snyfr;vs(cn.GnY=="G")nn=snyfr;vs(cn.GnY=="O")on=snyfr;ine k=0,l=0;fjvgpu(nq.NshP%8){pnfr 0:oernx;pnfr 1:vs(nn)l=-sf;oernx;pnfr 2:k=j-sf;oernx;pnfr 3:vs(en)k=j;oernx;pnfr 4:k=j-sf;l=u-sf;oernx;pnfr 5:k=j-sf;vs(on)l=u;oernx;pnfr 6:l=u-sf;oernx;pnfr 7:vs(yn)k=-sf;l=u-sf;oernx;}vs(nq.NshP++ 0)||(nethzragf.yratgu==3&&bG>0))){pyrneGvzrbhg(cay.UgU);cay.UgU=frgGvzrbhg(cay.UvqrNpgvba,(nethzragf.yratgu==3?bG:cay.UvqrGvzrbhgInyhr));}};;d1.IjErfrgGvzrbhg=d2(n,c,bG){c=IjTc(n,c);IjPnapryGvzrbhg(n,c);riny("IjFgnegGvzrbhg(NQ_VQ,c"+(nethzragf.yratgu==3?",bG":"")+")");};;d1.IjErfrgNyyGvzrbhgf=d2(n){sbe(ine c=0;ce)||(pheLo)){vs(jvaqbj.IjBaEbyybssNQ_VQ)IjBaEbyybssNQ_VQ(c);ryfr IjPybfrNq(NQ_VQ,c,gehr,"");}ryfr erghea;}IjPnapryZbhfrYvfgrareNQ_VQ();};;jvaqbj.IjFrgEbyybssCnaryNQ_VQ=shapgvba(c){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;c=IjTc(NQ_VQ,c);vs(jvaqbj.IjNqNQ_VQ&&jvaqbj.IjNqNQ_VQ.EbyybssCnary>-1)IjPnapryZbhfrYvfgrareNQ_VQ();vs(jvaqbj.IjNqNQ_VQ)jvaqbj.IjNqNQ_VQ.EbyybssCnary=c;gel{vs(q.nqqRiragYvfgrare)q.nqqRiragYvfgrare(z,s,snyfr);ryfr vs(q.nggnpuRirag)q.nggnpuRirag("ba"+z,s);}pngpu(r){}};;jvaqbj.IjPnapryZbhfrYvfgrareNQ_VQ=shapgvba(){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;vs(jvaqbj.IjNqNQ_VQ)jvaqbj.IjNqNQ_VQ.EbyybssCnary=-1;gel{vs(q.erzbirRiragYvfgrare)q.erzbirRiragYvfgrare(z,s,snyfr);ryfr vs(q.qrgnpuRirag)q.qrgnpuRirag("ba"+z,s);}pngpu(r){}};;jvaqbj.IjNqNQ_VQ.IjTc=shapgvba(n,c){ine nq=jvaqbj.IjNqNQ_VQ;vs(vfAnA(c)){sbe(ine v=0;v0){vs(nq.FzV.yratgu>0)nq.FzV+="/";nq.FzV+=vh[v];nq.FtZ[nq.FtZ.yratgu]=snyfr;}}};;jvaqbj.IjNqNQ_VQ.IjYvzvg0=shapgvba(n,f){ine nq=jvaqbj.IjNqNQ_VQ,vh=f.fcyvg("/");sbe(ine v=0;v0){vs(nq.OvC.yratgu>0)nq.OvC+="/";nq.OvC+=vh[v];}}};;jvaqbj.IjNqNQ_VQ.IjRVST=shapgvba(n,c){jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]=IjTrgBow("IjCnayNQ_VQ_"+c+"_Bow");vs(jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]==ahyy)frgGvzrbhg("IjRVST(NQ_VQ,"+c+")",jvaqbj.IjNqNQ_VQ.rvsg);};;jvaqbj.IjNqNQ_VQ.IjNavzSHC=shapgvba(n,c){ine nq=jvaqbj.IjNqNQ_VQ;vs(c>nq.Cnaryf.yratgu)erghea;ine cna=nq.Cnaryf[c],nn=gehr,on=gehr,yn=gehr,en=gehr,cn=nq.Cnaryf[0],sf=nq.ShF,j=cn.Jvqgu,u=cn.Urvtug;vs(j=="100%"){j=sf;en=snyfr;yn=snyfr;}vs(u=="100%"){u=sf;nn=snyfr;on=snyfr;}vs(cn.YnY=="Y")yn=snyfr;vs(cn.YnY=="E")en=snyfr;vs(cn.GnY=="G")nn=snyfr;vs(cn.GnY=="O")on=snyfr;ine k=0,l=0;fjvgpu(nq.NshP%8){pnfr 0:oernx;pnfr 1:vs(nn)l=-sf;oernx;pnfr 2:k=j-sf;oernx;pnfr 3:vs(en)k=j;oernx;pnfr 4:k=j-sf;l=u-sf;oernx;pnfr 5:k=j-sf;vs(on)l=u;oernx;pnfr 6:l=u-sf;oernx;pnfr 7:vs(yn)k=-sf;l=u-sf;oernx;}vs(nq.NshP++ 0)||(nethzragf.yratgu==3&&bG>0))){pyrneGvzrbhg(cay.UgU);cay.UgU=frgGvzrbhg(cay.UvqrNpgvba,(nethzragf.yratgu==3?bG:cay.UvqrGvzrbhgInyhr));}};;jvaqbj.IjNqNQ_VQ.IjErfrgGvzrbhg=shapgvba(n,c,bG){c=IjTc(n,c);IjPnapryGvzrbhg(n,c);riny("IjFgnegGvzrbhg(NQ_VQ,c"+(nethzragf.yratgu==3?",bG":"")+")");};;jvaqbj.IjNqNQ_VQ.IjErfrgNyyGvzrbhgf=shapgvba(n){sbe(ine c=0;ce)||(pheLo)){vs(jvaqbj.IjBaEbyybssNQ_VQ)IjBaEbyybssNQ_VQ(c);ryfr IjPybfrNq(NQ_VQ,c,gehr,"");}ryfr erghea;}IjPnapryZbhfrYvfgrareNQ_VQ();};;jvaqbj.IjFrgEbyybssCnaryNQ_VQ=shapgvba(c){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;c=IjTc(NQ_VQ,c);vs(jvaqbj.IjNqNQ_VQ&&jvaqbj.IjNqNQ_VQ.EbyybssCnary>-1)IjPnapryZbhfrYvfgrareNQ_VQ();vs(jvaqbj.IjNqNQ_VQ)jvaqbj.IjNqNQ_VQ.EbyybssCnary=c;gel{vs(q.nqqRiragYvfgrare)q.nqqRiragYvfgrare(z,s,snyfr);ryfr vs(q.nggnpuRirag)q.nggnpuRirag("ba"+z,s);}pngpu(r){}};;jvaqbj.IjPnapryZbhfrYvfgrareNQ_VQ=shapgvba(){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;vs(jvaqbj.IjNqNQ_VQ)jvaqbj.IjNqNQ_VQ.EbyybssCnary=-1;gel{vs(q.erzbirRiragYvfgrare)q.erzbirRiragYvfgrare(z,s,snyfr);ryfr vs(q.qrgnpuRirag)q.qrgnpuRirag("ba"+z,s);}pngpu(r){}};;jvaqbj.IjNqNQ_VQ.IjTc=d2(n,c){ine nq=jvaqbj.IjNqNQ_VQ;vs(vfAnA(c)){sbe(ine v=0;v0){vs(nq.FzV.yratgu>0)nq.FzV+="/";nq.FzV+=vh[v];nq.FtZ[nq.FtZ.yratgu]=snyfr;}}};;jvaqbj.IjNqNQ_VQ.IjYvzvg0=d2(n,f){ine nq=jvaqbj.IjNqNQ_VQ,vh=f.fcyvg("/");sbe(ine v=0;v0){vs(nq.OvC.yratgu>0)nq.OvC+="/";nq.OvC+=vh[v];}}};;jvaqbj.IjNqNQ_VQ.IjRVST=d2(n,c){jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]=IjTrgBow("IjCnayNQ_VQ_"+c+"_Bow");vs(jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]==ahyy)frgGvzrbhg("IjRVST(NQ_VQ,"+c+")",jvaqbj.IjNqNQ_VQ.rvsg);};;jvaqbj.IjNqNQ_VQ.IjNavzSHC=d2(n,c){ine nq=jvaqbj.IjNqNQ_VQ;vs(c>nq.Cnaryf.yratgu)erghea;ine cna=nq.Cnaryf[c],nn=gehr,on=gehr,yn=gehr,en=gehr,cn=nq.Cnaryf[0],sf=nq.ShF,j=cn.Jvqgu,u=cn.Urvtug;vs(j=="100%"){j=sf;en=snyfr;yn=snyfr;}vs(u=="100%"){u=sf;nn=snyfr;on=snyfr;}vs(cn.YnY=="Y")yn=snyfr;vs(cn.YnY=="E")en=snyfr;vs(cn.GnY=="G")nn=snyfr;vs(cn.GnY=="O")on=snyfr;ine k=0,l=0;fjvgpu(nq.NshP%8){pnfr 0:oernx;pnfr 1:vs(nn)l=-sf;oernx;pnfr 2:k=j-sf;oernx;pnfr 3:vs(en)k=j;oernx;pnfr 4:k=j-sf;l=u-sf;oernx;pnfr 5:k=j-sf;vs(on)l=u;oernx;pnfr 6:l=u-sf;oernx;pnfr 7:vs(yn)k=-sf;l=u-sf;oernx;}vs(nq.NshP++ 0)||(nethzragf.yratgu==3&&bG>0))){pyrneGvzrbhg(cay.UgU);cay.UgU=frgGvzrbhg(cay.UvqrNpgvba,(nethzragf.yratgu==3?bG:cay.UvqrGvzrbhgInyhr));}};;jvaqbj.IjNqNQ_VQ.IjErfrgGvzrbhg=d2(n,c,bG){c=IjTc(n,c);IjPnapryGvzrbhg(n,c);riny("IjFgnegGvzrbhg(NQ_VQ,c"+(nethzragf.yratgu==3?",bG":"")+")");};;jvaqbj.IjNqNQ_VQ.IjErfrgNyyGvzrbhgf=d2(n){sbe(ine c=0;c]/g; - var str15 = 'FrffvbaQQS2=s6r4579npn4rn2135s904r0s75pp1o5334p6s6pospo12696; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669316860113296&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_dfctwzs-aowb_80=44132r503660'; - var str16 = 'FrffvbaQQS2=s6r4579npn4rn2135s904r0s75pp1o5334p6s6pospo12696; AFP_zp_dfctwzs-aowb_80=44132r503660; __hgzm=144631658.1231363638.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.965867047679498800.1231363638.1231363638.1231363638.1; __hgzo=144631658.0.10.1231363638; __hgzp=144631658; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669316860113296&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str17 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231363621014&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231363621014&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Scebsvyr.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=348699119.1231363624&tn_fvq=1231363624&tn_uvq=895511034&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; - var str18 = 'uggc://jjj.yrobapbva.se/yv'; - var str19 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669316860113296&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str20 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669316860113296&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var str15 = + "FrffvbaQQS2=s6r4579npn4rn2135s904r0s75pp1o5334p6s6pospo12696; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669316860113296&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_dfctwzs-aowb_80=44132r503660"; + var str16 = + "FrffvbaQQS2=s6r4579npn4rn2135s904r0s75pp1o5334p6s6pospo12696; AFP_zp_dfctwzs-aowb_80=44132r503660; __hgzm=144631658.1231363638.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.965867047679498800.1231363638.1231363638.1231363638.1; __hgzo=144631658.0.10.1231363638; __hgzp=144631658; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669316860113296&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str17 = + "uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231363621014&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231363621014&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Scebsvyr.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=348699119.1231363624&tn_fvq=1231363624&tn_uvq=895511034&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22"; + var str18 = "uggc://jjj.yrobapbva.se/yv"; + var str19 = + "ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669316860113296&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str20 = + "ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669316860113296&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R="; - var s67 = computeInputVariants('e115', 27); - var s68 = computeInputVariants('qvfcynl', 27); - var s69 = computeInputVariants('cbfvgvba', 27); - var s70 = computeInputVariants('uggc://jjj.zlfcnpr.pbz/', 27); - var s71 = computeInputVariants('cntrivrj', 27); - var s72 = computeInputVariants('VC=74.125.75.3', 27); - var s73 = computeInputVariants('ra', 27); + var s67 = computeInputVariants("e115", 27); + var s68 = computeInputVariants("qvfcynl", 27); + var s69 = computeInputVariants("cbfvgvba", 27); + var s70 = computeInputVariants("uggc://jjj.zlfcnpr.pbz/", 27); + var s71 = computeInputVariants("cntrivrj", 27); + var s72 = computeInputVariants("VC=74.125.75.3", 27); + var s73 = computeInputVariants("ra", 27); var s74 = computeInputVariants(str10, 27); var s75 = computeInputVariants(str11, 27); var s76 = computeInputVariants(str12, 27); @@ -409,32 +449,32 @@ function RegExpBenchmark() { function runBlock3() { for (var i = 0; i < 27; i++) { - s67[i].replace(/[A-Za-z]/g, ''); + s67[i].replace(/[A-Za-z]/g, ""); } for (var i = 0; i < 23; i++) { - s68[i].replace(re27, ''); - s69[i].replace(re27, ''); + s68[i].replace(re27, ""); + s69[i].replace(re27, ""); } for (var i = 0; i < 22; i++) { - 'unaqyr'.replace(re14, ''); - 'unaqyr'.replace(re15, ''); - 'yvar'.replace(re14, ''); - 'yvar'.replace(re15, ''); - 'cnerag puebzr6 fvatyr1 gno'.replace(re14, ''); - 'cnerag puebzr6 fvatyr1 gno'.replace(re15, ''); - 'fyvqre'.replace(re14, ''); - 'fyvqre'.replace(re15, ''); - re28.exec(''); + "unaqyr".replace(re14, ""); + "unaqyr".replace(re15, ""); + "yvar".replace(re14, ""); + "yvar".replace(re15, ""); + "cnerag puebzr6 fvatyr1 gno".replace(re14, ""); + "cnerag puebzr6 fvatyr1 gno".replace(re15, ""); + "fyvqre".replace(re14, ""); + "fyvqre".replace(re15, ""); + re28.exec(""); } for (var i = 0; i < 21; i++) { - s70[i].replace(re12, ''); + s70[i].replace(re12, ""); re13.exec(s70[i]); } for (var i = 0; i < 20; i++) { - s71[i].replace(re29, ''); - s71[i].replace(re30, ''); - re19.exec('ynfg'); - re19.exec('ba svefg'); + s71[i].replace(re29, ""); + s71[i].replace(re30, ""); + re19.exec("ynfg"); + re19.exec("ba svefg"); re8.exec(s72[i]); } for (var i = 0; i < 19; i++) { @@ -443,15 +483,23 @@ function RegExpBenchmark() { for (var i = 0; i < 18; i++) { s74[i].split(re32); s75[i].split(re32); - s76[i].replace(re33, ''); - re8.exec('144631658.0.10.1231363570'); - re8.exec('144631658.1231363570.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); - re8.exec('144631658.3426875219718084000.1231363570.1231363570.1231363570.1'); + s76[i].replace(re33, ""); + re8.exec("144631658.0.10.1231363570"); + re8.exec( + "144631658.1231363570.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); + re8.exec( + "144631658.3426875219718084000.1231363570.1231363570.1231363570.1" + ); re8.exec(str13); re8.exec(str14); - re8.exec('__hgzn=144631658.3426875219718084000.1231363570.1231363570.1231363570.1'); - re8.exec('__hgzo=144631658.0.10.1231363570'); - re8.exec('__hgzm=144631658.1231363570.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec( + "__hgzn=144631658.3426875219718084000.1231363570.1231363570.1231363570.1" + ); + re8.exec("__hgzo=144631658.0.10.1231363570"); + re8.exec( + "__hgzm=144631658.1231363570.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); re34.exec(s74[i]); re34.exec(s75[i]); } @@ -460,53 +508,61 @@ function RegExpBenchmark() { s15[i].match(/bcren/gi); str15.split(re32); str16.split(re32); - 'ohggba'.replace(re14, ''); - 'ohggba'.replace(re15, ''); - 'puvyq p1 svefg sylbhg pybfrq'.replace(re14, ''); - 'puvyq p1 svefg sylbhg pybfrq'.replace(re15, ''); - 'pvgvrf'.replace(re14, ''); - 'pvgvrf'.replace(re15, ''); - 'pybfrq'.replace(re14, ''); - 'pybfrq'.replace(re15, ''); - 'qry'.replace(re14, ''); - 'qry'.replace(re15, ''); - 'uqy_zba'.replace(re14, ''); - 'uqy_zba'.replace(re15, ''); - s77[i].replace(re33, ''); - s78[i].replace(/%3P/g, ''); - s78[i].replace(/%3R/g, ''); - s78[i].replace(/%3q/g, ''); - s78[i].replace(re35, ''); - 'yvaxyvfg16'.replace(re14, ''); - 'yvaxyvfg16'.replace(re15, ''); - 'zvahf'.replace(re14, ''); - 'zvahf'.replace(re15, ''); - 'bcra'.replace(re14, ''); - 'bcra'.replace(re15, ''); - 'cnerag puebzr5 fvatyr1 ps NU'.replace(re14, ''); - 'cnerag puebzr5 fvatyr1 ps NU'.replace(re15, ''); - 'cynlre'.replace(re14, ''); - 'cynlre'.replace(re15, ''); - 'cyhf'.replace(re14, ''); - 'cyhf'.replace(re15, ''); - 'cb_uqy'.replace(re14, ''); - 'cb_uqy'.replace(re15, ''); - 'hyJVzt'.replace(re14, ''); - 'hyJVzt'.replace(re15, ''); - re8.exec('144631658.0.10.1231363638'); - re8.exec('144631658.1231363638.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); - re8.exec('144631658.965867047679498800.1231363638.1231363638.1231363638.1'); - re8.exec('4413268q3660'); - re8.exec('4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n'); - re8.exec('SbeprqRkcvengvba=633669321699093060'); - re8.exec('VC=74.125.75.20'); + "ohggba".replace(re14, ""); + "ohggba".replace(re15, ""); + "puvyq p1 svefg sylbhg pybfrq".replace(re14, ""); + "puvyq p1 svefg sylbhg pybfrq".replace(re15, ""); + "pvgvrf".replace(re14, ""); + "pvgvrf".replace(re15, ""); + "pybfrq".replace(re14, ""); + "pybfrq".replace(re15, ""); + "qry".replace(re14, ""); + "qry".replace(re15, ""); + "uqy_zba".replace(re14, ""); + "uqy_zba".replace(re15, ""); + s77[i].replace(re33, ""); + s78[i].replace(/%3P/g, ""); + s78[i].replace(/%3R/g, ""); + s78[i].replace(/%3q/g, ""); + s78[i].replace(re35, ""); + "yvaxyvfg16".replace(re14, ""); + "yvaxyvfg16".replace(re15, ""); + "zvahf".replace(re14, ""); + "zvahf".replace(re15, ""); + "bcra".replace(re14, ""); + "bcra".replace(re15, ""); + "cnerag puebzr5 fvatyr1 ps NU".replace(re14, ""); + "cnerag puebzr5 fvatyr1 ps NU".replace(re15, ""); + "cynlre".replace(re14, ""); + "cynlre".replace(re15, ""); + "cyhf".replace(re14, ""); + "cyhf".replace(re15, ""); + "cb_uqy".replace(re14, ""); + "cb_uqy".replace(re15, ""); + "hyJVzt".replace(re14, ""); + "hyJVzt".replace(re15, ""); + re8.exec("144631658.0.10.1231363638"); + re8.exec( + "144631658.1231363638.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); + re8.exec( + "144631658.965867047679498800.1231363638.1231363638.1231363638.1" + ); + re8.exec("4413268q3660"); + re8.exec("4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n"); + re8.exec("SbeprqRkcvengvba=633669321699093060"); + re8.exec("VC=74.125.75.20"); re8.exec(str19); re8.exec(str20); - re8.exec('AFP_zp_tfwsbrg-aowb_80=4413268q3660'); - re8.exec('FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n'); - re8.exec('__hgzn=144631658.965867047679498800.1231363638.1231363638.1231363638.1'); - re8.exec('__hgzo=144631658.0.10.1231363638'); - re8.exec('__hgzm=144631658.1231363638.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec("AFP_zp_tfwsbrg-aowb_80=4413268q3660"); + re8.exec("FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n"); + re8.exec( + "__hgzn=144631658.965867047679498800.1231363638.1231363638.1231363638.1" + ); + re8.exec("__hgzo=144631658.0.10.1231363638"); + re8.exec( + "__hgzm=144631658.1231363638.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); re34.exec(str15); re34.exec(str16); } @@ -514,12 +570,17 @@ function RegExpBenchmark() { var re36 = /uers|fep|fryrpgrq/; var re37 = /\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g; var re38 = /^(\w+|\*)$/; - var str21 = 'FrffvbaQQS2=s15q53p9n372sn76npr13o271n4s3p5r29p235746p908p58; ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669358527244818&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; - var str22 = 'FrffvbaQQS2=s15q53p9n372sn76npr13o271n4s3p5r29p235746p908p58; __hgzm=144631658.1231367822.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.4127520630321984500.1231367822.1231367822.1231367822.1; __hgzo=144631658.0.10.1231367822; __hgzp=144631658; ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669358527244818&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str23 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231367803797&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231367803797&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Szrffntvat.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1192552091.1231367807&tn_fvq=1231367807&tn_uvq=1155446857&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; - var str24 = 'ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669358527244818&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str25 = 'ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669358527244818&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; - var str26 = 'hy.ynat-fryrpgbe'; + var str21 = + "FrffvbaQQS2=s15q53p9n372sn76npr13o271n4s3p5r29p235746p908p58; ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669358527244818&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R="; + var str22 = + "FrffvbaQQS2=s15q53p9n372sn76npr13o271n4s3p5r29p235746p908p58; __hgzm=144631658.1231367822.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.4127520630321984500.1231367822.1231367822.1231367822.1; __hgzo=144631658.0.10.1231367822; __hgzp=144631658; ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669358527244818&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str23 = + "uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231367803797&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231367803797&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Szrffntvat.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1192552091.1231367807&tn_fvq=1231367807&tn_uvq=1155446857&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22"; + var str24 = + "ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669358527244818&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str25 = + "ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669358527244818&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R="; + var str26 = "hy.ynat-fryrpgbe"; var re39 = /\\/g; var re40 = / /g; var re41 = /\/\xc4\/t/; @@ -538,61 +599,71 @@ function RegExpBenchmark() { function runBlock4() { for (var i = 0; i < 16; i++) { - ''.replace(/\*/g, ''); - /\bnpgvir\b/.exec('npgvir'); + "".replace(/\*/g, ""); + /\bnpgvir\b/.exec("npgvir"); /sversbk/i.exec(s15[i]); - re36.exec('glcr'); + re36.exec("glcr"); /zfvr/i.exec(s15[i]); /bcren/i.exec(s15[i]); } for (var i = 0; i < 15; i++) { s79[i].split(re32); s80[i].split(re32); - 'uggc://ohyyrgvaf.zlfcnpr.pbz/vaqrk.psz'.replace(re12, ''); - s81[i].replace(re33, ''); - 'yv'.replace(re37, ''); - 'yv'.replace(re18, ''); - re8.exec('144631658.0.10.1231367822'); - re8.exec('144631658.1231367822.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); - re8.exec('144631658.4127520630321984500.1231367822.1231367822.1231367822.1'); + "uggc://ohyyrgvaf.zlfcnpr.pbz/vaqrk.psz".replace(re12, ""); + s81[i].replace(re33, ""); + "yv".replace(re37, ""); + "yv".replace(re18, ""); + re8.exec("144631658.0.10.1231367822"); + re8.exec( + "144631658.1231367822.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); + re8.exec( + "144631658.4127520630321984500.1231367822.1231367822.1231367822.1" + ); re8.exec(str24); re8.exec(str25); - re8.exec('__hgzn=144631658.4127520630321984500.1231367822.1231367822.1231367822.1'); - re8.exec('__hgzo=144631658.0.10.1231367822'); - re8.exec('__hgzm=144631658.1231367822.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec( + "__hgzn=144631658.4127520630321984500.1231367822.1231367822.1231367822.1" + ); + re8.exec("__hgzo=144631658.0.10.1231367822"); + re8.exec( + "__hgzm=144631658.1231367822.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); re34.exec(s79[i]); re34.exec(s80[i]); - /\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)["']?(.*?)["']?)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g.exec(s82[i]); - re13.exec('uggc://ohyyrgvaf.zlfcnpr.pbz/vaqrk.psz'); - re38.exec('yv'); + /\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)["']?(.*?)["']?)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g.exec( + s82[i] + ); + re13.exec("uggc://ohyyrgvaf.zlfcnpr.pbz/vaqrk.psz"); + re38.exec("yv"); } for (var i = 0; i < 14; i++) { - ''.replace(re18, ''); - '9.0 e115'.replace(/(\s+e|\s+o[0-9]+)/, ''); - 'Funer guvf tnqtrg'.replace(//g, ''); - 'Funer guvf tnqtrg'.replace(re39, ''); - 'uggc://cebsvyrrqvg.zlfcnpr.pbz/vaqrk.psz'.replace(re12, ''); - 'grnfre'.replace(re40, ''); - 'grnfre'.replace(re41, ''); - 'grnfre'.replace(re42, ''); - 'grnfre'.replace(re43, ''); - 'grnfre'.replace(re44, ''); - 'grnfre'.replace(re45, ''); - 'grnfre'.replace(re46, ''); - 'grnfre'.replace(re47, ''); - 'grnfre'.replace(re48, ''); - re16.exec('znetva-gbc'); - re16.exec('cbfvgvba'); - re19.exec('gno1'); - re9.exec('qz'); - re9.exec('qg'); - re9.exec('zbqobk'); - re9.exec('zbqobkva'); - re9.exec('zbqgvgyr'); - re13.exec('uggc://cebsvyrrqvg.zlfcnpr.pbz/vaqrk.psz'); - re26.exec('/vt/znvytnqtrg'); - re49.exec('glcr'); + "".replace(re18, ""); + "9.0 e115".replace(/(\s+e|\s+o[0-9]+)/, ""); + "Funer guvf tnqtrg".replace(//g, ""); + "Funer guvf tnqtrg".replace(re39, ""); + "uggc://cebsvyrrqvg.zlfcnpr.pbz/vaqrk.psz".replace(re12, ""); + "grnfre".replace(re40, ""); + "grnfre".replace(re41, ""); + "grnfre".replace(re42, ""); + "grnfre".replace(re43, ""); + "grnfre".replace(re44, ""); + "grnfre".replace(re45, ""); + "grnfre".replace(re46, ""); + "grnfre".replace(re47, ""); + "grnfre".replace(re48, ""); + re16.exec("znetva-gbc"); + re16.exec("cbfvgvba"); + re19.exec("gno1"); + re9.exec("qz"); + re9.exec("qg"); + re9.exec("zbqobk"); + re9.exec("zbqobkva"); + re9.exec("zbqgvgyr"); + re13.exec("uggc://cebsvyrrqvg.zlfcnpr.pbz/vaqrk.psz"); + re26.exec("/vt/znvytnqtrg"); + re49.exec("glcr"); } } var re50 = /(?:^|\s+)fryrpgrq(?:\s+|$)/; @@ -604,73 +675,87 @@ function RegExpBenchmark() { var re56 = /(\$\{cngu\})|(\$cngu\b)/g; function runBlock5() { for (var i = 0; i < 13; i++) { - 'purpx'.replace(re14, ''); - 'purpx'.replace(re15, ''); - 'pvgl'.replace(re14, ''); - 'pvgl'.replace(re15, ''); - 'qrpe fyvqrgrkg'.replace(re14, ''); - 'qrpe fyvqrgrkg'.replace(re15, ''); - 'svefg fryrpgrq'.replace(re14, ''); - 'svefg fryrpgrq'.replace(re15, ''); - 'uqy_rag'.replace(re14, ''); - 'uqy_rag'.replace(re15, ''); - 'vape fyvqrgrkg'.replace(re14, ''); - 'vape fyvqrgrkg'.replace(re15, ''); - 'vachggrkg QBZPbageby_cynprubyqre'.replace(re5, ''); - 'cnerag puebzr6 fvatyr1 gno fryrpgrq'.replace(re14, ''); - 'cnerag puebzr6 fvatyr1 gno fryrpgrq'.replace(re15, ''); - 'cb_guz'.replace(re14, ''); - 'cb_guz'.replace(re15, ''); - 'fhozvg'.replace(re14, ''); - 'fhozvg'.replace(re15, ''); - re50.exec(''); + "purpx".replace(re14, ""); + "purpx".replace(re15, ""); + "pvgl".replace(re14, ""); + "pvgl".replace(re15, ""); + "qrpe fyvqrgrkg".replace(re14, ""); + "qrpe fyvqrgrkg".replace(re15, ""); + "svefg fryrpgrq".replace(re14, ""); + "svefg fryrpgrq".replace(re15, ""); + "uqy_rag".replace(re14, ""); + "uqy_rag".replace(re15, ""); + "vape fyvqrgrkg".replace(re14, ""); + "vape fyvqrgrkg".replace(re15, ""); + "vachggrkg QBZPbageby_cynprubyqre".replace(re5, ""); + "cnerag puebzr6 fvatyr1 gno fryrpgrq".replace(re14, ""); + "cnerag puebzr6 fvatyr1 gno fryrpgrq".replace(re15, ""); + "cb_guz".replace(re14, ""); + "cb_guz".replace(re15, ""); + "fhozvg".replace(re14, ""); + "fhozvg".replace(re15, ""); + re50.exec(""); /NccyrJroXvg\/([^\s]*)/.exec(s15[i]); /XUGZY/.exec(s15[i]); } for (var i = 0; i < 12; i++) { - '${cebg}://${ubfg}${cngu}/${dz}'.replace(/(\$\{cebg\})|(\$cebg\b)/g, ''); - '1'.replace(re40, ''); - '1'.replace(re10, ''); - '1'.replace(re51, ''); - '1'.replace(re52, ''); - '1'.replace(re53, ''); - '1'.replace(re39, ''); - '1'.replace(re54, ''); - '9.0 e115'.replace(/^(.*)\..*$/, ''); - '9.0 e115'.replace(/^.*e(.*)$/, ''); - ''.replace(re55, ''); - ''.replace(re55, ''); - s21[i].replace(/^.*\s+(\S+\s+\S+$)/, ''); - 'tzk%2Subzrcntr%2Sfgneg%2Sqr%2S'.replace(re30, ''); - 'tzk'.replace(re30, ''); - 'uggc://${ubfg}${cngu}/${dz}'.replace(/(\$\{ubfg\})|(\$ubfg\b)/g, ''); - 'uggc://nqpyvrag.hvzfrei.arg${cngu}/${dz}'.replace(re56, ''); - 'uggc://nqpyvrag.hvzfrei.arg/wf.at/${dz}'.replace(/(\$\{dz\})|(\$dz\b)/g, ''); - 'frpgvba'.replace(re29, ''); - 'frpgvba'.replace(re30, ''); - 'fvgr'.replace(re29, ''); - 'fvgr'.replace(re30, ''); - 'fcrpvny'.replace(re29, ''); - 'fcrpvny'.replace(re30, ''); - re36.exec('anzr'); - /e/.exec('9.0 e115'); + "${cebg}://${ubfg}${cngu}/${dz}".replace(/(\$\{cebg\})|(\$cebg\b)/g, ""); + "1".replace(re40, ""); + "1".replace(re10, ""); + "1".replace(re51, ""); + "1".replace(re52, ""); + "1".replace(re53, ""); + "1".replace(re39, ""); + "1".replace(re54, ""); + "9.0 e115".replace(/^(.*)\..*$/, ""); + "9.0 e115".replace(/^.*e(.*)$/, ""); + "".replace(re55, ""); + ''.replace( + re55, + "" + ); + s21[i].replace(/^.*\s+(\S+\s+\S+$)/, ""); + "tzk%2Subzrcntr%2Sfgneg%2Sqr%2S".replace(re30, ""); + "tzk".replace(re30, ""); + "uggc://${ubfg}${cngu}/${dz}".replace(/(\$\{ubfg\})|(\$ubfg\b)/g, ""); + "uggc://nqpyvrag.hvzfrei.arg${cngu}/${dz}".replace(re56, ""); + "uggc://nqpyvrag.hvzfrei.arg/wf.at/${dz}".replace( + /(\$\{dz\})|(\$dz\b)/g, + "" + ); + "frpgvba".replace(re29, ""); + "frpgvba".replace(re30, ""); + "fvgr".replace(re29, ""); + "fvgr".replace(re30, ""); + "fcrpvny".replace(re29, ""); + "fcrpvny".replace(re30, ""); + re36.exec("anzr"); + /e/.exec("9.0 e115"); } } var re57 = /##yv4##/gi; var re58 = /##yv16##/gi; var re59 = /##yv19##/gi; - var str27 = '##yv4##Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.##yv16##Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; - var str28 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.##yv16##Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; - var str29 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; - var str30 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; - var str31 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl. ##N##Yrnea zber##/N##'; - var str32 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl. Yrnea zber##/N##'; - var str33 = 'Bar Jvaqbjf Yvir VQ trgf lbh vagb Ubgznvy, Zrffratre, Kobk YVIR \u2014 naq bgure cynprf lbh frr #~#argjbexybtb#~#'; + var str27 = + '##yv4##Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.##yv16##Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; + var str28 = + 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.##yv16##Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; + var str29 = + 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; + var str30 = + 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; + var str31 = + 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl. ##N##Yrnea zber##/N##'; + var str32 = + 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl. Yrnea zber##/N##'; + var str33 = + "Bar Jvaqbjf Yvir VQ trgf lbh vagb Ubgznvy, Zrffratre, Kobk YVIR \u2014 naq bgure cynprf lbh frr #~#argjbexybtb#~#"; var re60 = /(?:^|\s+)bss(?:\s+|$)/; var re61 = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/; var re62 = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/; - var str34 = '${1}://${2}${3}${4}${5}'; - var str35 = ' O=6gnyg0g4znrrn&o=3&f=gc; Q=_lyu=K3bQZGSxnT4lZzD3OS9GNmV3ZGLkAQxRpTyxNmRlZmRmAmNkAQLRqTImqNZjOUEgpTjQnJ5xMKtgoN--; SCF=qy'; + var str34 = "${1}://${2}${3}${4}${5}"; + var str35 = + " O=6gnyg0g4znrrn&o=3&f=gc; Q=_lyu=K3bQZGSxnT4lZzD3OS9GNmV3ZGLkAQxRpTyxNmRlZmRmAmNkAQLRqTImqNZjOUEgpTjQnJ5xMKtgoN--; SCF=qy"; var s83 = computeInputVariants(str27, 11); var s84 = computeInputVariants(str28, 11); var s85 = computeInputVariants(str29, 11); @@ -682,20 +767,20 @@ function RegExpBenchmark() { function runBlock6() { for (var i = 0; i < 11; i++) { - s83[i].replace(/##yv0##/gi, ''); - s83[i].replace(re57, ''); - s84[i].replace(re58, ''); - s85[i].replace(re59, ''); - s86[i].replace(/##\/o##/gi, ''); - s86[i].replace(/##\/v##/gi, ''); - s86[i].replace(/##\/h##/gi, ''); - s86[i].replace(/##o##/gi, ''); - s86[i].replace(/##oe##/gi, ''); - s86[i].replace(/##v##/gi, ''); - s86[i].replace(/##h##/gi, ''); - s87[i].replace(/##n##/gi, ''); - s88[i].replace(/##\/n##/gi, ''); - s89[i].replace(/#~#argjbexybtb#~#/g, ''); + s83[i].replace(/##yv0##/gi, ""); + s83[i].replace(re57, ""); + s84[i].replace(re58, ""); + s85[i].replace(re59, ""); + s86[i].replace(/##\/o##/gi, ""); + s86[i].replace(/##\/v##/gi, ""); + s86[i].replace(/##\/h##/gi, ""); + s86[i].replace(/##o##/gi, ""); + s86[i].replace(/##oe##/gi, ""); + s86[i].replace(/##v##/gi, ""); + s86[i].replace(/##h##/gi, ""); + s87[i].replace(/##n##/gi, ""); + s88[i].replace(/##\/n##/gi, ""); + s89[i].replace(/#~#argjbexybtb#~#/g, ""); / Zbovyr\//.exec(s15[i]); /##yv1##/gi.exec(s83[i]); /##yv10##/gi.exec(s84[i]); @@ -720,117 +805,132 @@ function RegExpBenchmark() { /##yv7##/gi.exec(s84[i]); /##yv8##/gi.exec(s84[i]); /##yv9##/gi.exec(s84[i]); - re8.exec('473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29'); - re8.exec('SbeprqRkcvengvba=633669325184628362'); - re8.exec('FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29'); + re8.exec("473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29"); + re8.exec("SbeprqRkcvengvba=633669325184628362"); + re8.exec("FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29"); /AbxvnA[^\/]*/.exec(s15[i]); } for (var i = 0; i < 10; i++) { - ' bss'.replace(/(?:^|\s+)bss(?:\s+|$)/g, ''); - s90[i].replace(/(\$\{0\})|(\$0\b)/g, ''); - s90[i].replace(/(\$\{1\})|(\$1\b)/g, ''); - s90[i].replace(/(\$\{pbzcyrgr\})|(\$pbzcyrgr\b)/g, ''); - s90[i].replace(/(\$\{sentzrag\})|(\$sentzrag\b)/g, ''); - s90[i].replace(/(\$\{ubfgcbeg\})|(\$ubfgcbeg\b)/g, ''); - s90[i].replace(re56, ''); - s90[i].replace(/(\$\{cebgbpby\})|(\$cebgbpby\b)/g, ''); - s90[i].replace(/(\$\{dhrel\})|(\$dhrel\b)/g, ''); - 'nqfvmr'.replace(re29, ''); - 'nqfvmr'.replace(re30, ''); - 'uggc://${2}${3}${4}${5}'.replace(/(\$\{2\})|(\$2\b)/g, ''); - 'uggc://wf.hv-cbegny.qr${3}${4}${5}'.replace(/(\$\{3\})|(\$3\b)/g, ''); - 'arjf'.replace(re40, ''); - 'arjf'.replace(re41, ''); - 'arjf'.replace(re42, ''); - 'arjf'.replace(re43, ''); - 'arjf'.replace(re44, ''); - 'arjf'.replace(re45, ''); - 'arjf'.replace(re46, ''); - 'arjf'.replace(re47, ''); - 'arjf'.replace(re48, ''); + " bss".replace(/(?:^|\s+)bss(?:\s+|$)/g, ""); + s90[i].replace(/(\$\{0\})|(\$0\b)/g, ""); + s90[i].replace(/(\$\{1\})|(\$1\b)/g, ""); + s90[i].replace(/(\$\{pbzcyrgr\})|(\$pbzcyrgr\b)/g, ""); + s90[i].replace(/(\$\{sentzrag\})|(\$sentzrag\b)/g, ""); + s90[i].replace(/(\$\{ubfgcbeg\})|(\$ubfgcbeg\b)/g, ""); + s90[i].replace(re56, ""); + s90[i].replace(/(\$\{cebgbpby\})|(\$cebgbpby\b)/g, ""); + s90[i].replace(/(\$\{dhrel\})|(\$dhrel\b)/g, ""); + "nqfvmr".replace(re29, ""); + "nqfvmr".replace(re30, ""); + "uggc://${2}${3}${4}${5}".replace(/(\$\{2\})|(\$2\b)/g, ""); + "uggc://wf.hv-cbegny.qr${3}${4}${5}".replace(/(\$\{3\})|(\$3\b)/g, ""); + "arjf".replace(re40, ""); + "arjf".replace(re41, ""); + "arjf".replace(re42, ""); + "arjf".replace(re43, ""); + "arjf".replace(re44, ""); + "arjf".replace(re45, ""); + "arjf".replace(re46, ""); + "arjf".replace(re47, ""); + "arjf".replace(re48, ""); / PC=i=(\d+)&oe=(.)/.exec(str35); - re60.exec(' '); - re60.exec(' bss'); - re60.exec(''); - re19.exec(' '); - re19.exec('svefg ba'); - re19.exec('ynfg vtaber'); - re19.exec('ba'); - re9.exec('scnq so '); - re9.exec('zrqvgobk'); - re9.exec('hsgy'); - re9.exec('lhv-h'); + re60.exec(" "); + re60.exec(" bss"); + re60.exec(""); + re19.exec(" "); + re19.exec("svefg ba"); + re19.exec("ynfg vtaber"); + re19.exec("ba"); + re9.exec("scnq so "); + re9.exec("zrqvgobk"); + re9.exec("hsgy"); + re9.exec("lhv-h"); /Fnsnev|Xbadhrebe|XUGZY/gi.exec(s15[i]); - re61.exec('uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf'); - re62.exec('#Ybtva_rznvy'); + re61.exec("uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf"); + re62.exec("#Ybtva_rznvy"); } } var re63 = /\{0\}/g; - var str36 = 'FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n; ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669321699093060&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_tfwsbrg-aowb_80=4413268q3660'; - var str37 = 'FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n; AFP_zp_tfwsbrg-aowb_80=4413268q3660; __hgzm=144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.2294274870215848400.1231364074.1231364074.1231364074.1; __hgzo=144631658.0.10.1231364074; __hgzp=144631658; ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669321699093060&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str38 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231364057761&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231364057761&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Ssevraqf.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1667363813.1231364061&tn_fvq=1231364061&tn_uvq=1917563877&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; - var str39 = 'ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669321699093060&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str40 = 'ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669321699093060&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var str36 = + "FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n; ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669321699093060&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_tfwsbrg-aowb_80=4413268q3660"; + var str37 = + "FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n; AFP_zp_tfwsbrg-aowb_80=4413268q3660; __hgzm=144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.2294274870215848400.1231364074.1231364074.1231364074.1; __hgzo=144631658.0.10.1231364074; __hgzp=144631658; ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669321699093060&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str38 = + "uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231364057761&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231364057761&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Ssevraqf.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1667363813.1231364061&tn_fvq=1231364061&tn_uvq=1917563877&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22"; + var str39 = + "ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669321699093060&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str40 = + "ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669321699093060&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R="; var s91 = computeInputVariants(str36, 9); var s92 = computeInputVariants(str37, 9); var s93 = computeInputVariants(str38, 9); function runBlock7() { for (var i = 0; i < 9; i++) { - '0'.replace(re40, ''); - '0'.replace(re10, ''); - '0'.replace(re51, ''); - '0'.replace(re52, ''); - '0'.replace(re53, ''); - '0'.replace(re39, ''); - '0'.replace(re54, ''); - 'Lrf'.replace(re40, ''); - 'Lrf'.replace(re10, ''); - 'Lrf'.replace(re51, ''); - 'Lrf'.replace(re52, ''); - 'Lrf'.replace(re53, ''); - 'Lrf'.replace(re39, ''); - 'Lrf'.replace(re54, ''); + "0".replace(re40, ""); + "0".replace(re10, ""); + "0".replace(re51, ""); + "0".replace(re52, ""); + "0".replace(re53, ""); + "0".replace(re39, ""); + "0".replace(re54, ""); + "Lrf".replace(re40, ""); + "Lrf".replace(re10, ""); + "Lrf".replace(re51, ""); + "Lrf".replace(re52, ""); + "Lrf".replace(re53, ""); + "Lrf".replace(re39, ""); + "Lrf".replace(re54, ""); } for (var i = 0; i < 8; i++) { - 'Pybfr {0}'.replace(re63, ''); - 'Bcra {0}'.replace(re63, ''); + "Pybfr {0}".replace(re63, ""); + "Bcra {0}".replace(re63, ""); s91[i].split(re32); s92[i].split(re32); - 'puvyq p1 svefg gnournqref'.replace(re14, ''); - 'puvyq p1 svefg gnournqref'.replace(re15, ''); - 'uqy_fcb'.replace(re14, ''); - 'uqy_fcb'.replace(re15, ''); - 'uvag'.replace(re14, ''); - 'uvag'.replace(re15, ''); - s93[i].replace(re33, ''); - 'yvfg'.replace(re14, ''); - 'yvfg'.replace(re15, ''); - 'at_bhgre'.replace(re30, ''); - 'cnerag puebzr5 qbhoyr2 NU'.replace(re14, ''); - 'cnerag puebzr5 qbhoyr2 NU'.replace(re15, ''); - 'cnerag puebzr5 dhnq5 ps NU osyvax zbarl'.replace(re14, ''); - 'cnerag puebzr5 dhnq5 ps NU osyvax zbarl'.replace(re15, ''); - 'cnerag puebzr6 fvatyr1'.replace(re14, ''); - 'cnerag puebzr6 fvatyr1'.replace(re15, ''); - 'cb_qrs'.replace(re14, ''); - 'cb_qrs'.replace(re15, ''); - 'gnopbagrag'.replace(re14, ''); - 'gnopbagrag'.replace(re15, ''); - 'iv_svefg_gvzr'.replace(re30, ''); - /(^|.)(ronl|qri-ehf3.wbg)(|fgberf|zbgbef|yvirnhpgvbaf|jvxv|rkcerff|punggre).(pbz(|.nh|.pa|.ux|.zl|.ft|.oe|.zk)|pb(.hx|.xe|.am)|pn|qr|se|vg|ay|or|ng|pu|vr|va|rf|cy|cu|fr)$/i.exec('cntrf.ronl.pbz'); - re8.exec('144631658.0.10.1231364074'); - re8.exec('144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); - re8.exec('144631658.2294274870215848400.1231364074.1231364074.1231364074.1'); - re8.exec('4413241q3660'); - re8.exec('SbeprqRkcvengvba=633669357391353591'); + "puvyq p1 svefg gnournqref".replace(re14, ""); + "puvyq p1 svefg gnournqref".replace(re15, ""); + "uqy_fcb".replace(re14, ""); + "uqy_fcb".replace(re15, ""); + "uvag".replace(re14, ""); + "uvag".replace(re15, ""); + s93[i].replace(re33, ""); + "yvfg".replace(re14, ""); + "yvfg".replace(re15, ""); + "at_bhgre".replace(re30, ""); + "cnerag puebzr5 qbhoyr2 NU".replace(re14, ""); + "cnerag puebzr5 qbhoyr2 NU".replace(re15, ""); + "cnerag puebzr5 dhnq5 ps NU osyvax zbarl".replace(re14, ""); + "cnerag puebzr5 dhnq5 ps NU osyvax zbarl".replace(re15, ""); + "cnerag puebzr6 fvatyr1".replace(re14, ""); + "cnerag puebzr6 fvatyr1".replace(re15, ""); + "cb_qrs".replace(re14, ""); + "cb_qrs".replace(re15, ""); + "gnopbagrag".replace(re14, ""); + "gnopbagrag".replace(re15, ""); + "iv_svefg_gvzr".replace(re30, ""); + /(^|.)(ronl|qri-ehf3.wbg)(|fgberf|zbgbef|yvirnhpgvbaf|jvxv|rkcerff|punggre).(pbz(|.nh|.pa|.ux|.zl|.ft|.oe|.zk)|pb(.hx|.xe|.am)|pn|qr|se|vg|ay|or|ng|pu|vr|va|rf|cy|cu|fr)$/i.exec( + "cntrf.ronl.pbz" + ); + re8.exec("144631658.0.10.1231364074"); + re8.exec( + "144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); + re8.exec( + "144631658.2294274870215848400.1231364074.1231364074.1231364074.1" + ); + re8.exec("4413241q3660"); + re8.exec("SbeprqRkcvengvba=633669357391353591"); re8.exec(str39); re8.exec(str40); - re8.exec('AFP_zp_kkk-gdzogv_80=4413241q3660'); - re8.exec('FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7'); - re8.exec('__hgzn=144631658.2294274870215848400.1231364074.1231364074.1231364074.1'); - re8.exec('__hgzo=144631658.0.10.1231364074'); - re8.exec('__hgzm=144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); - re8.exec('p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7'); + re8.exec("AFP_zp_kkk-gdzogv_80=4413241q3660"); + re8.exec("FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7"); + re8.exec( + "__hgzn=144631658.2294274870215848400.1231364074.1231364074.1231364074.1" + ); + re8.exec("__hgzo=144631658.0.10.1231364074"); + re8.exec( + "__hgzm=144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); + re8.exec("p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7"); re34.exec(s91[i]); re34.exec(s92[i]); } @@ -838,94 +938,103 @@ function RegExpBenchmark() { var re64 = /\b[a-z]/g; var re65 = /^uggc:\/\//; var re66 = /(?:^|\s+)qvfnoyrq(?:\s+|$)/; - var str41 = 'uggc://cebsvyr.zlfcnpr.pbz/Zbqhyrf/Nccyvpngvbaf/Cntrf/Pnainf.nfck'; + var str41 = + "uggc://cebsvyr.zlfcnpr.pbz/Zbqhyrf/Nccyvpngvbaf/Cntrf/Pnainf.nfck"; function runBlock8() { for (var i = 0; i < 7; i++) { s21[i].match(/\d+/g); - 'nsgre'.replace(re64, ''); - 'orsber'.replace(re64, ''); - 'obggbz'.replace(re64, ''); - 'ohvygva_jrngure.kzy'.replace(re65, ''); - 'ohggba'.replace(re37, ''); - 'ohggba'.replace(re18, ''); - 'qngrgvzr.kzy'.replace(re65, ''); - 'uggc://eff.paa.pbz/eff/paa_gbcfgbevrf.eff'.replace(re65, ''); - 'vachg'.replace(re37, ''); - 'vachg'.replace(re18, ''); - 'vafvqr'.replace(re64, ''); - 'cbvagre'.replace(re27, ''); - 'cbfvgvba'.replace(/[A-Z]/g, ''); - 'gbc'.replace(re27, ''); - 'gbc'.replace(re64, ''); - 'hy'.replace(re37, ''); - 'hy'.replace(re18, ''); - str26.replace(re37, ''); - str26.replace(re18, ''); - 'lbhghor_vtbbtyr/i2/lbhghor.kzy'.replace(re65, ''); - 'm-vaqrk'.replace(re27, ''); + "nsgre".replace(re64, ""); + "orsber".replace(re64, ""); + "obggbz".replace(re64, ""); + "ohvygva_jrngure.kzy".replace(re65, ""); + "ohggba".replace(re37, ""); + "ohggba".replace(re18, ""); + "qngrgvzr.kzy".replace(re65, ""); + "uggc://eff.paa.pbz/eff/paa_gbcfgbevrf.eff".replace(re65, ""); + "vachg".replace(re37, ""); + "vachg".replace(re18, ""); + "vafvqr".replace(re64, ""); + "cbvagre".replace(re27, ""); + "cbfvgvba".replace(/[A-Z]/g, ""); + "gbc".replace(re27, ""); + "gbc".replace(re64, ""); + "hy".replace(re37, ""); + "hy".replace(re18, ""); + str26.replace(re37, ""); + str26.replace(re18, ""); + "lbhghor_vtbbtyr/i2/lbhghor.kzy".replace(re65, ""); + "m-vaqrk".replace(re27, ""); /#([\w-]+)/.exec(str26); - re16.exec('urvtug'); - re16.exec('znetvaGbc'); - re16.exec('jvqgu'); - re19.exec('gno0 svefg ba'); - re19.exec('gno0 ba'); - re19.exec('gno4 ynfg'); - re19.exec('gno4'); - re19.exec('gno5'); - re19.exec('gno6'); - re19.exec('gno7'); - re19.exec('gno8'); + re16.exec("urvtug"); + re16.exec("znetvaGbc"); + re16.exec("jvqgu"); + re19.exec("gno0 svefg ba"); + re19.exec("gno0 ba"); + re19.exec("gno4 ynfg"); + re19.exec("gno4"); + re19.exec("gno5"); + re19.exec("gno6"); + re19.exec("gno7"); + re19.exec("gno8"); /NqborNVE\/([^\s]*)/.exec(s15[i]); /NccyrJroXvg\/([^ ]*)/.exec(s15[i]); /XUGZY/gi.exec(s15[i]); - /^(?:obql|ugzy)$/i.exec('YV'); - re38.exec('ohggba'); - re38.exec('vachg'); - re38.exec('hy'); + /^(?:obql|ugzy)$/i.exec("YV"); + re38.exec("ohggba"); + re38.exec("vachg"); + re38.exec("hy"); re38.exec(str26); /^(\w+|\*)/.exec(str26); - /znp|jva|yvahk/i.exec('Jva32'); - /eton?\([\d\s,]+\)/.exec('fgngvp'); + /znp|jva|yvahk/i.exec("Jva32"); + /eton?\([\d\s,]+\)/.exec("fgngvp"); } for (var i = 0; i < 6; i++) { - ''.replace(/\r/g, ''); - '/'.replace(re40, ''); - '/'.replace(re10, ''); - '/'.replace(re51, ''); - '/'.replace(re52, ''); - '/'.replace(re53, ''); - '/'.replace(re39, ''); - '/'.replace(re54, ''); - 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/{0}?[NDO]&{1}&{2}&[NDR]'.replace(re63, ''); - str41.replace(re12, ''); - 'uggc://jjj.snprobbx.pbz/fepu.cuc'.replace(re23, ''); - 'freivpr'.replace(re40, ''); - 'freivpr'.replace(re41, ''); - 'freivpr'.replace(re42, ''); - 'freivpr'.replace(re43, ''); - 'freivpr'.replace(re44, ''); - 'freivpr'.replace(re45, ''); - 'freivpr'.replace(re46, ''); - 'freivpr'.replace(re47, ''); - 'freivpr'.replace(re48, ''); + "".replace(/\r/g, ""); + "/".replace(re40, ""); + "/".replace(re10, ""); + "/".replace(re51, ""); + "/".replace(re52, ""); + "/".replace(re53, ""); + "/".replace(re39, ""); + "/".replace(re54, ""); + "uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/{0}?[NDO]&{1}&{2}&[NDR]".replace( + re63, + "" + ); + str41.replace(re12, ""); + "uggc://jjj.snprobbx.pbz/fepu.cuc".replace(re23, ""); + "freivpr".replace(re40, ""); + "freivpr".replace(re41, ""); + "freivpr".replace(re42, ""); + "freivpr".replace(re43, ""); + "freivpr".replace(re44, ""); + "freivpr".replace(re45, ""); + "freivpr".replace(re46, ""); + "freivpr".replace(re47, ""); + "freivpr".replace(re48, ""); /((ZFVR\s+([6-9]|\d\d)\.))/.exec(s15[i]); - re66.exec(''); - re50.exec('fryrpgrq'); - re8.exec('8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn'); - re8.exec('SbeprqRkcvengvba=633669340386893867'); - re8.exec('VC=74.125.75.17'); - re8.exec('FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn'); + re66.exec(""); + re50.exec("fryrpgrq"); + re8.exec("8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn"); + re8.exec("SbeprqRkcvengvba=633669340386893867"); + re8.exec("VC=74.125.75.17"); + re8.exec("FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn"); /Xbadhrebe|Fnsnev|XUGZY/.exec(s15[i]); re13.exec(str41); - re49.exec('unfsbphf'); + re49.exec("unfsbphf"); } } var re67 = /zrah_byq/g; - var str42 = 'FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669325184628362&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; - var str43 = 'FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29; __hgzm=144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.3931862196947939300.1231364380.1231364380.1231364380.1; __hgzo=144631658.0.10.1231364380; __hgzp=144631658; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669325184628362&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str44 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_vzntrf_wf&qg=1231364373088&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231364373088&punaary=svz_zlfcnpr_hfre-ivrj-pbzzragf%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Spbzzrag.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1158737789.1231364375&tn_fvq=1231364375&tn_uvq=415520832&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; - var str45 = 'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669325184628362&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str46 = 'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669325184628362&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var str42 = + "FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669325184628362&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R="; + var str43 = + "FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29; __hgzm=144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.3931862196947939300.1231364380.1231364380.1231364380.1; __hgzo=144631658.0.10.1231364380; __hgzp=144631658; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669325184628362&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str44 = + "uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_vzntrf_wf&qg=1231364373088&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231364373088&punaary=svz_zlfcnpr_hfre-ivrj-pbzzragf%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Spbzzrag.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1158737789.1231364375&tn_fvq=1231364375&tn_uvq=415520832&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22"; + var str45 = + "ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669325184628362&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str46 = + "ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669325184628362&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R="; var re68 = /^([#.]?)((?:[\w\u0128-\uffff*_-]|\\.)*)/; var re69 = /\{1\}/g; var re70 = /\s+/; @@ -938,28 +1047,43 @@ function RegExpBenchmark() { var re77 = /\bucfie\s*=\s*([^;]*)/i; var re78 = /\bhfucjrn\s*=\s*([^;]*)/i; var re79 = /\bmvc\s*=\s*([^;]*)/i; - var re80 = /^((?:[\w\u0128-\uffff*_-]|\\.)+)(#)((?:[\w\u0128-\uffff*_-]|\\.)+)/; + var re80 = + /^((?:[\w\u0128-\uffff*_-]|\\.)+)(#)((?:[\w\u0128-\uffff*_-]|\\.)+)/; var re81 = /^([>+~])\s*(\w*)/i; var re82 = /^>\s*((?:[\w\u0128-\uffff*_-]|\\.)+)/; var re83 = /^[\s[]?shapgvba/; var re84 = /v\/g.tvs#(.*)/i; - var str47 = '#Zbq-Vasb-Vasb-WninFpevcgUvag'; - var str48 = ',n.svryqOgaPnapry'; - var str49 = 'FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669357391353591&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_kkk-gdzogv_80=4413241q3660'; - var str50 = 'FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7; AFP_zp_kkk-gdzogv_80=4413241q3660; AFP_zp_kkk-aowb_80=4413235p3660; __hgzm=144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.2770915348920628700.1231367708.1231367708.1231367708.1; __hgzo=144631658.0.10.1231367708; __hgzp=144631658; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669357391353591&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str51 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231367691141&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231367691141&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Sjjj.zlfcnpr.pbz%2S&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=320757904.1231367694&tn_fvq=1231367694&tn_uvq=1758792003&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; - var str52 = 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55332979829981?[NDO]&aqu=1&g=7%2S0%2S2009%2014%3N38%3N42%203%20480&af=zfacbegny&cntrAnzr=HF%20UCZFSGJ&t=uggc%3N%2S%2Sjjj.zfa.pbz%2S&f=1024k768&p=24&x=L&oj=994&ou=634&uc=A&{2}&[NDR]'; - var str53 = 'cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq qbhoyr2 ps'; - var str54 = 'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669357391353591&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str55 = 'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669357391353591&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; - var str56 = 'ne;ng;nh;or;oe;pn;pu;py;pa;qr;qx;rf;sv;se;to;ux;vq;vr;va;vg;wc;xe;zk;zl;ay;ab;am;cu;cy;cg;eh;fr;ft;gu;ge;gj;mn;'; - var str57 = 'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886&GHVQ=1'; - var str58 = 'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886'; - var str59 = 'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886; mvc=m:94043|yn:37.4154|yb:-122.0585|p:HF|ue:1'; - var str60 = 'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886; mvc=m:94043|yn:37.4154|yb:-122.0585|p:HF'; - var str61 = 'uggc://gx2.fgp.f-zfa.pbz/oe/uc/11/ra-hf/pff/v/g.tvs#uggc://gx2.fgo.f-zfa.pbz/v/29/4RQP4969777N048NPS4RRR3PO2S7S.wct'; - var str62 = 'uggc://gx2.fgp.f-zfa.pbz/oe/uc/11/ra-hf/pff/v/g.tvs#uggc://gx2.fgo.f-zfa.pbz/v/OQ/63NP9O94NS5OQP1249Q9S1ROP7NS3.wct'; - var str63 = 'zbmvyyn/5.0 (jvaqbjf; h; jvaqbjf ag 5.1; ra-hf) nccyrjroxvg/528.9 (xugzy, yvxr trpxb) puebzr/2.0.157.0 fnsnev/528.9'; + var str47 = "#Zbq-Vasb-Vasb-WninFpevcgUvag"; + var str48 = ",n.svryqOgaPnapry"; + var str49 = + "FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669357391353591&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_kkk-gdzogv_80=4413241q3660"; + var str50 = + "FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7; AFP_zp_kkk-gdzogv_80=4413241q3660; AFP_zp_kkk-aowb_80=4413235p3660; __hgzm=144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.2770915348920628700.1231367708.1231367708.1231367708.1; __hgzo=144631658.0.10.1231367708; __hgzp=144631658; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669357391353591&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str51 = + "uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231367691141&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231367691141&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Sjjj.zlfcnpr.pbz%2S&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=320757904.1231367694&tn_fvq=1231367694&tn_uvq=1758792003&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22"; + var str52 = + "uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55332979829981?[NDO]&aqu=1&g=7%2S0%2S2009%2014%3N38%3N42%203%20480&af=zfacbegny&cntrAnzr=HF%20UCZFSGJ&t=uggc%3N%2S%2Sjjj.zfa.pbz%2S&f=1024k768&p=24&x=L&oj=994&ou=634&uc=A&{2}&[NDR]"; + var str53 = "cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq qbhoyr2 ps"; + var str54 = + "ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669357391353591&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str55 = + "ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669357391353591&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R="; + var str56 = + "ne;ng;nh;or;oe;pn;pu;py;pa;qr;qx;rf;sv;se;to;ux;vq;vr;va;vg;wc;xe;zk;zl;ay;ab;am;cu;cy;cg;eh;fr;ft;gu;ge;gj;mn;"; + var str57 = + "ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886&GHVQ=1"; + var str58 = + "ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886"; + var str59 = + "ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886; mvc=m:94043|yn:37.4154|yb:-122.0585|p:HF|ue:1"; + var str60 = + "ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886; mvc=m:94043|yn:37.4154|yb:-122.0585|p:HF"; + var str61 = + "uggc://gx2.fgp.f-zfa.pbz/oe/uc/11/ra-hf/pff/v/g.tvs#uggc://gx2.fgo.f-zfa.pbz/v/29/4RQP4969777N048NPS4RRR3PO2S7S.wct"; + var str62 = + "uggc://gx2.fgp.f-zfa.pbz/oe/uc/11/ra-hf/pff/v/g.tvs#uggc://gx2.fgo.f-zfa.pbz/v/OQ/63NP9O94NS5OQP1249Q9S1ROP7NS3.wct"; + var str63 = + "zbmvyyn/5.0 (jvaqbjf; h; jvaqbjf ag 5.1; ra-hf) nccyrjroxvg/528.9 (xugzy, yvxr trpxb) puebzr/2.0.157.0 fnsnev/528.9"; var s94 = computeInputVariants(str42, 5); var s95 = computeInputVariants(str43, 5); var s96 = computeInputVariants(str44, 5); @@ -975,129 +1099,175 @@ function RegExpBenchmark() { for (var i = 0; i < 5; i++) { s94[i].split(re32); s95[i].split(re32); - 'svz_zlfcnpr_hfre-ivrj-pbzzragf,svz_zlfcnpr_havgrq-fgngrf'.split(re20); - s96[i].replace(re33, ''); - 'zrah_arj zrah_arj_gbttyr zrah_gbttyr'.replace(re67, ''); - 'zrah_byq zrah_byq_gbttyr zrah_gbttyr'.replace(re67, ''); - re8.exec('102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98'); - re8.exec('144631658.0.10.1231364380'); - re8.exec('144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); - re8.exec('144631658.3931862196947939300.1231364380.1231364380.1231364380.1'); - re8.exec('441326q33660'); - re8.exec('SbeprqRkcvengvba=633669341278771470'); + "svz_zlfcnpr_hfre-ivrj-pbzzragf,svz_zlfcnpr_havgrq-fgngrf".split(re20); + s96[i].replace(re33, ""); + "zrah_arj zrah_arj_gbttyr zrah_gbttyr".replace(re67, ""); + "zrah_byq zrah_byq_gbttyr zrah_gbttyr".replace(re67, ""); + re8.exec("102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98"); + re8.exec("144631658.0.10.1231364380"); + re8.exec( + "144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); + re8.exec( + "144631658.3931862196947939300.1231364380.1231364380.1231364380.1" + ); + re8.exec("441326q33660"); + re8.exec("SbeprqRkcvengvba=633669341278771470"); re8.exec(str45); re8.exec(str46); - re8.exec('AFP_zp_dfctwzssrwh-aowb_80=441326q33660'); - re8.exec('FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98'); - re8.exec('__hgzn=144631658.3931862196947939300.1231364380.1231364380.1231364380.1'); - re8.exec('__hgzo=144631658.0.10.1231364380'); - re8.exec('__hgzm=144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec("AFP_zp_dfctwzssrwh-aowb_80=441326q33660"); + re8.exec("FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98"); + re8.exec( + "__hgzn=144631658.3931862196947939300.1231364380.1231364380.1231364380.1" + ); + re8.exec("__hgzo=144631658.0.10.1231364380"); + re8.exec( + "__hgzm=144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); } for (var i = 0; i < 4; i++) { - ' yvfg1'.replace(re14, ''); - ' yvfg1'.replace(re15, ''); - ' yvfg2'.replace(re14, ''); - ' yvfg2'.replace(re15, ''); - ' frneputebhc1'.replace(re14, ''); - ' frneputebhc1'.replace(re15, ''); - s97[i].replace(re68, ''); - s97[i].replace(re18, ''); - ''.replace(/&/g, ''); - ''.replace(re35, ''); - '(..-{0})(\|(\d+)|)'.replace(re63, ''); - s98[i].replace(re18, ''); - '//vzt.jro.qr/vij/FC/${cngu}/${anzr}/${inyhr}?gf=${abj}'.replace(re56, ''); - '//vzt.jro.qr/vij/FC/tzk_uc/${anzr}/${inyhr}?gf=${abj}'.replace(/(\$\{anzr\})|(\$anzr\b)/g, ''); - 'Jvaqbjf Yvir Ubgznvy{1}'.replace(re69, ''); - '{0}{1}'.replace(re63, ''); - '{1}'.replace(re69, ''); - '{1}'.replace(re63, ''); - 'Vzntrf'.replace(re15, ''); - 'ZFA'.replace(re15, ''); - 'Zncf'.replace(re15, ''); - 'Zbq-Vasb-Vasb-WninFpevcgUvag'.replace(re39, ''); - 'Arjf'.replace(re15, ''); + " yvfg1".replace(re14, ""); + " yvfg1".replace(re15, ""); + " yvfg2".replace(re14, ""); + " yvfg2".replace(re15, ""); + " frneputebhc1".replace(re14, ""); + " frneputebhc1".replace(re15, ""); + s97[i].replace(re68, ""); + s97[i].replace(re18, ""); + "".replace(/&/g, ""); + "".replace(re35, ""); + "(..-{0})(|(d+)|)".replace(re63, ""); + s98[i].replace(re18, ""); + "//vzt.jro.qr/vij/FC/${cngu}/${anzr}/${inyhr}?gf=${abj}".replace( + re56, + "" + ); + "//vzt.jro.qr/vij/FC/tzk_uc/${anzr}/${inyhr}?gf=${abj}".replace( + /(\$\{anzr\})|(\$anzr\b)/g, + "" + ); + 'Jvaqbjf Yvir Ubgznvy{1}'.replace( + re69, + "" + ); + '{0}{1}'.replace( + re63, + "" + ); + '{1}'.replace( + re69, + "" + ); + '{1}'.replace( + re63, + "" + ); + "Vzntrf".replace(re15, ""); + "ZFA".replace(re15, ""); + "Zncf".replace(re15, ""); + "Zbq-Vasb-Vasb-WninFpevcgUvag".replace(re39, ""); + "Arjf".replace(re15, ""); s99[i].split(re32); s100[i].split(re32); - 'Ivqrb'.replace(re15, ''); - 'Jro'.replace(re15, ''); - 'n'.replace(re39, ''); - 'nwnkFgneg'.split(re70); - 'nwnkFgbc'.split(re70); - 'ovaq'.replace(re14, ''); - 'ovaq'.replace(re15, ''); - 'oevatf lbh zber. Zber fcnpr (5TO), zber frphevgl, fgvyy serr.'.replace(re63, ''); - 'puvyq p1 svefg qrpx'.replace(re14, ''); - 'puvyq p1 svefg qrpx'.replace(re15, ''); - 'puvyq p1 svefg qbhoyr2'.replace(re14, ''); - 'puvyq p1 svefg qbhoyr2'.replace(re15, ''); - 'puvyq p2 ynfg'.replace(re14, ''); - 'puvyq p2 ynfg'.replace(re15, ''); - 'puvyq p2'.replace(re14, ''); - 'puvyq p2'.replace(re15, ''); - 'puvyq p3'.replace(re14, ''); - 'puvyq p3'.replace(re15, ''); - 'puvyq p4 ynfg'.replace(re14, ''); - 'puvyq p4 ynfg'.replace(re15, ''); - 'pbclevtug'.replace(re14, ''); - 'pbclevtug'.replace(re15, ''); - 'qZFAZR_1'.replace(re14, ''); - 'qZFAZR_1'.replace(re15, ''); - 'qbhoyr2 ps'.replace(re14, ''); - 'qbhoyr2 ps'.replace(re15, ''); - 'qbhoyr2'.replace(re14, ''); - 'qbhoyr2'.replace(re15, ''); - 'uqy_arj'.replace(re14, ''); - 'uqy_arj'.replace(re15, ''); - 'uc_fubccvatobk'.replace(re30, ''); - 'ugzy%2Rvq'.replace(re29, ''); - 'ugzy%2Rvq'.replace(re30, ''); - s101[i].replace(re33, ''); - 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/cebgbglcr.wf${4}${5}'.replace(re71, ''); - 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/cebgbglcr.wf${5}'.replace(re72, ''); - s102[i].replace(re73, ''); - 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55332979829981?[NDO]&{1}&{2}&[NDR]'.replace(re69, ''); - 'vztZFSG'.replace(re14, ''); - 'vztZFSG'.replace(re15, ''); - 'zfasbbg1 ps'.replace(re14, ''); - 'zfasbbg1 ps'.replace(re15, ''); - s103[i].replace(re14, ''); - s103[i].replace(re15, ''); - 'cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq'.replace(re14, ''); - 'cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq'.replace(re15, ''); - 'cevznel'.replace(re14, ''); - 'cevznel'.replace(re15, ''); - 'erpgnatyr'.replace(re30, ''); - 'frpbaqnel'.replace(re14, ''); - 'frpbaqnel'.replace(re15, ''); - 'haybnq'.split(re70); - '{0}{1}1'.replace(re63, ''); - '|{1}1'.replace(re69, ''); - /(..-HF)(\|(\d+)|)/i.exec('xb-xe,ra-va,gu-gu'); - re4.exec('/ZlFcnprNccf/NccPnainf,45000012'); - re8.exec('144631658.0.10.1231367708'); - re8.exec('144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); - re8.exec('144631658.2770915348920628700.1231367708.1231367708.1231367708.1'); - re8.exec('4413235p3660'); - re8.exec('441327q73660'); - re8.exec('9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473'); - re8.exec('SbeprqRkcvengvba=633669350559478880'); + "Ivqrb".replace(re15, ""); + "Jro".replace(re15, ""); + "n".replace(re39, ""); + "nwnkFgneg".split(re70); + "nwnkFgbc".split(re70); + "ovaq".replace(re14, ""); + "ovaq".replace(re15, ""); + "oevatf lbh zber. Zber fcnpr (5TO), zber frphevgl, fgvyy serr.".replace( + re63, + "" + ); + "puvyq p1 svefg qrpx".replace(re14, ""); + "puvyq p1 svefg qrpx".replace(re15, ""); + "puvyq p1 svefg qbhoyr2".replace(re14, ""); + "puvyq p1 svefg qbhoyr2".replace(re15, ""); + "puvyq p2 ynfg".replace(re14, ""); + "puvyq p2 ynfg".replace(re15, ""); + "puvyq p2".replace(re14, ""); + "puvyq p2".replace(re15, ""); + "puvyq p3".replace(re14, ""); + "puvyq p3".replace(re15, ""); + "puvyq p4 ynfg".replace(re14, ""); + "puvyq p4 ynfg".replace(re15, ""); + "pbclevtug".replace(re14, ""); + "pbclevtug".replace(re15, ""); + "qZFAZR_1".replace(re14, ""); + "qZFAZR_1".replace(re15, ""); + "qbhoyr2 ps".replace(re14, ""); + "qbhoyr2 ps".replace(re15, ""); + "qbhoyr2".replace(re14, ""); + "qbhoyr2".replace(re15, ""); + "uqy_arj".replace(re14, ""); + "uqy_arj".replace(re15, ""); + "uc_fubccvatobk".replace(re30, ""); + "ugzy%2Rvq".replace(re29, ""); + "ugzy%2Rvq".replace(re30, ""); + s101[i].replace(re33, ""); + "uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/cebgbglcr.wf${4}${5}".replace( + re71, + "" + ); + "uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/cebgbglcr.wf${5}".replace( + re72, + "" + ); + s102[i].replace(re73, ""); + "uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55332979829981?[NDO]&{1}&{2}&[NDR]".replace( + re69, + "" + ); + "vztZFSG".replace(re14, ""); + "vztZFSG".replace(re15, ""); + "zfasbbg1 ps".replace(re14, ""); + "zfasbbg1 ps".replace(re15, ""); + s103[i].replace(re14, ""); + s103[i].replace(re15, ""); + "cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq".replace(re14, ""); + "cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq".replace(re15, ""); + "cevznel".replace(re14, ""); + "cevznel".replace(re15, ""); + "erpgnatyr".replace(re30, ""); + "frpbaqnel".replace(re14, ""); + "frpbaqnel".replace(re15, ""); + "haybnq".split(re70); + "{0}{1}1".replace(re63, ""); + "|{1}1".replace(re69, ""); + /(..-HF)(\|(\d+)|)/i.exec("xb-xe,ra-va,gu-gu"); + re4.exec("/ZlFcnprNccf/NccPnainf,45000012"); + re8.exec("144631658.0.10.1231367708"); + re8.exec( + "144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); + re8.exec( + "144631658.2770915348920628700.1231367708.1231367708.1231367708.1" + ); + re8.exec("4413235p3660"); + re8.exec("441327q73660"); + re8.exec("9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473"); + re8.exec("SbeprqRkcvengvba=633669350559478880"); re8.exec(str54); re8.exec(str55); - re8.exec('AFP_zp_dfctwzs-aowb_80=441327q73660'); - re8.exec('AFP_zp_kkk-aowb_80=4413235p3660'); - re8.exec('FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473'); - re8.exec('__hgzn=144631658.2770915348920628700.1231367708.1231367708.1231367708.1'); - re8.exec('__hgzo=144631658.0.10.1231367708'); - re8.exec('__hgzm=144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec("AFP_zp_dfctwzs-aowb_80=441327q73660"); + re8.exec("AFP_zp_kkk-aowb_80=4413235p3660"); + re8.exec("FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473"); + re8.exec( + "__hgzn=144631658.2770915348920628700.1231367708.1231367708.1231367708.1" + ); + re8.exec("__hgzo=144631658.0.10.1231367708"); + re8.exec( + "__hgzm=144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); re34.exec(s99[i]); re34.exec(s100[i]); /ZFVR\s+5[.]01/.exec(s15[i]); /HF(?=;)/i.exec(str56); re74.exec(s97[i]); - re28.exec('svefg npgvir svefgNpgvir'); - re28.exec('ynfg'); - /\bp:(..)/i.exec('m:94043|yn:37.4154|yb:-122.0585|p:HF'); + re28.exec("svefg npgvir svefgNpgvir"); + re28.exec("ynfg"); + /\bp:(..)/i.exec("m:94043|yn:37.4154|yb:-122.0585|p:HF"); re75.exec(str57); re75.exec(str58); re76.exec(str57); @@ -1111,15 +1281,15 @@ function RegExpBenchmark() { re79.exec(str58); re79.exec(str60); re79.exec(str59); - /\|p:([a-z]{2})/i.exec('m:94043|yn:37.4154|yb:-122.0585|p:HF|ue:1'); + /\|p:([a-z]{2})/i.exec("m:94043|yn:37.4154|yb:-122.0585|p:HF|ue:1"); re80.exec(s97[i]); - re61.exec('cebgbglcr.wf'); + re61.exec("cebgbglcr.wf"); re68.exec(s97[i]); re81.exec(s97[i]); re82.exec(s97[i]); /^Fubpxjnir Synfu (\d)/.exec(s21[i]); /^Fubpxjnir Synfu (\d+)/.exec(s21[i]); - re83.exec('[bowrpg tybony]'); + re83.exec("[bowrpg tybony]"); re62.exec(s97[i]); re84.exec(str61); re84.exec(str62); @@ -1127,167 +1297,180 @@ function RegExpBenchmark() { } } var re85 = /eaq_zbqobkva/; - var str64 = '1231365729213'; - var str65 = '74.125.75.3-1057165600.29978900'; - var str66 = '74.125.75.3-1057165600.29978900.1231365730214'; - var str67 = 'Frnepu%20Zvpebfbsg.pbz'; - var str68 = 'FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn; ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669340386893867&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; - var str69 = 'FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn; __hgzm=144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1877536177953918500.1231365779.1231365779.1231365779.1; __hgzo=144631658.0.10.1231365779; __hgzp=144631658; ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669340386893867&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str70 = 'I=3%26THVQ=757q3ss871q44o7o805n8113n5p72q52'; - var str71 = 'I=3&THVQ=757q3ss871q44o7o805n8113n5p72q52'; - var str72 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231365765292&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231365765292&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Sohyyrgvaf.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1579793869.1231365768&tn_fvq=1231365768&tn_uvq=2056210897&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; - var str73 = 'frnepu.zvpebfbsg.pbz'; - var str74 = 'frnepu.zvpebfbsg.pbz/'; - var str75 = 'ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669340386893867&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str76 = 'ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669340386893867&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; + var str64 = "1231365729213"; + var str65 = "74.125.75.3-1057165600.29978900"; + var str66 = "74.125.75.3-1057165600.29978900.1231365730214"; + var str67 = "Frnepu%20Zvpebfbsg.pbz"; + var str68 = + "FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn; ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669340386893867&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R="; + var str69 = + "FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn; __hgzm=144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1877536177953918500.1231365779.1231365779.1231365779.1; __hgzo=144631658.0.10.1231365779; __hgzp=144631658; ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669340386893867&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str70 = "I=3%26THVQ=757q3ss871q44o7o805n8113n5p72q52"; + var str71 = "I=3&THVQ=757q3ss871q44o7o805n8113n5p72q52"; + var str72 = + "uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231365765292&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231365765292&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Sohyyrgvaf.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1579793869.1231365768&tn_fvq=1231365768&tn_uvq=2056210897&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22"; + var str73 = "frnepu.zvpebfbsg.pbz"; + var str74 = "frnepu.zvpebfbsg.pbz/"; + var str75 = + "ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669340386893867&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str76 = + "ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669340386893867&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R="; function runBlock10() { for (var i = 0; i < 3; i++) { - '%3Szxg=ra-HF'.replace(re39, ''); - '-8'.replace(re40, ''); - '-8'.replace(re10, ''); - '-8'.replace(re51, ''); - '-8'.replace(re52, ''); - '-8'.replace(re53, ''); - '-8'.replace(re39, ''); - '-8'.replace(re54, ''); - '1.5'.replace(re40, ''); - '1.5'.replace(re10, ''); - '1.5'.replace(re51, ''); - '1.5'.replace(re52, ''); - '1.5'.replace(re53, ''); - '1.5'.replace(re39, ''); - '1.5'.replace(re54, ''); - '1024k768'.replace(re40, ''); - '1024k768'.replace(re10, ''); - '1024k768'.replace(re51, ''); - '1024k768'.replace(re52, ''); - '1024k768'.replace(re53, ''); - '1024k768'.replace(re39, ''); - '1024k768'.replace(re54, ''); - str64.replace(re40, ''); - str64.replace(re10, ''); - str64.replace(re51, ''); - str64.replace(re52, ''); - str64.replace(re53, ''); - str64.replace(re39, ''); - str64.replace(re54, ''); - '14'.replace(re40, ''); - '14'.replace(re10, ''); - '14'.replace(re51, ''); - '14'.replace(re52, ''); - '14'.replace(re53, ''); - '14'.replace(re39, ''); - '14'.replace(re54, ''); - '24'.replace(re40, ''); - '24'.replace(re10, ''); - '24'.replace(re51, ''); - '24'.replace(re52, ''); - '24'.replace(re53, ''); - '24'.replace(re39, ''); - '24'.replace(re54, ''); - str65.replace(re40, ''); - str65.replace(re10, ''); - str65.replace(re51, ''); - str65.replace(re52, ''); - str65.replace(re53, ''); - str65.replace(re39, ''); - str65.replace(re54, ''); - str66.replace(re40, ''); - str66.replace(re10, ''); - str66.replace(re51, ''); - str66.replace(re52, ''); - str66.replace(re53, ''); - str66.replace(re39, ''); - str66.replace(re54, ''); - '9.0'.replace(re40, ''); - '9.0'.replace(re10, ''); - '9.0'.replace(re51, ''); - '9.0'.replace(re52, ''); - '9.0'.replace(re53, ''); - '9.0'.replace(re39, ''); - '9.0'.replace(re54, ''); - '994k634'.replace(re40, ''); - '994k634'.replace(re10, ''); - '994k634'.replace(re51, ''); - '994k634'.replace(re52, ''); - '994k634'.replace(re53, ''); - '994k634'.replace(re39, ''); - '994k634'.replace(re54, ''); - '?zxg=ra-HF'.replace(re40, ''); - '?zxg=ra-HF'.replace(re10, ''); - '?zxg=ra-HF'.replace(re51, ''); - '?zxg=ra-HF'.replace(re52, ''); - '?zxg=ra-HF'.replace(re53, ''); - '?zxg=ra-HF'.replace(re54, ''); - 'PAA.pbz'.replace(re25, ''); - 'PAA.pbz'.replace(re12, ''); - 'PAA.pbz'.replace(re39, ''); - 'Qngr & Gvzr'.replace(re25, ''); - 'Qngr & Gvzr'.replace(re12, ''); - 'Qngr & Gvzr'.replace(re39, ''); - 'Frnepu Zvpebfbsg.pbz'.replace(re40, ''); - 'Frnepu Zvpebfbsg.pbz'.replace(re54, ''); - str67.replace(re10, ''); - str67.replace(re51, ''); - str67.replace(re52, ''); - str67.replace(re53, ''); - str67.replace(re39, ''); + "%3Szxg=ra-HF".replace(re39, ""); + "-8".replace(re40, ""); + "-8".replace(re10, ""); + "-8".replace(re51, ""); + "-8".replace(re52, ""); + "-8".replace(re53, ""); + "-8".replace(re39, ""); + "-8".replace(re54, ""); + "1.5".replace(re40, ""); + "1.5".replace(re10, ""); + "1.5".replace(re51, ""); + "1.5".replace(re52, ""); + "1.5".replace(re53, ""); + "1.5".replace(re39, ""); + "1.5".replace(re54, ""); + "1024k768".replace(re40, ""); + "1024k768".replace(re10, ""); + "1024k768".replace(re51, ""); + "1024k768".replace(re52, ""); + "1024k768".replace(re53, ""); + "1024k768".replace(re39, ""); + "1024k768".replace(re54, ""); + str64.replace(re40, ""); + str64.replace(re10, ""); + str64.replace(re51, ""); + str64.replace(re52, ""); + str64.replace(re53, ""); + str64.replace(re39, ""); + str64.replace(re54, ""); + "14".replace(re40, ""); + "14".replace(re10, ""); + "14".replace(re51, ""); + "14".replace(re52, ""); + "14".replace(re53, ""); + "14".replace(re39, ""); + "14".replace(re54, ""); + "24".replace(re40, ""); + "24".replace(re10, ""); + "24".replace(re51, ""); + "24".replace(re52, ""); + "24".replace(re53, ""); + "24".replace(re39, ""); + "24".replace(re54, ""); + str65.replace(re40, ""); + str65.replace(re10, ""); + str65.replace(re51, ""); + str65.replace(re52, ""); + str65.replace(re53, ""); + str65.replace(re39, ""); + str65.replace(re54, ""); + str66.replace(re40, ""); + str66.replace(re10, ""); + str66.replace(re51, ""); + str66.replace(re52, ""); + str66.replace(re53, ""); + str66.replace(re39, ""); + str66.replace(re54, ""); + "9.0".replace(re40, ""); + "9.0".replace(re10, ""); + "9.0".replace(re51, ""); + "9.0".replace(re52, ""); + "9.0".replace(re53, ""); + "9.0".replace(re39, ""); + "9.0".replace(re54, ""); + "994k634".replace(re40, ""); + "994k634".replace(re10, ""); + "994k634".replace(re51, ""); + "994k634".replace(re52, ""); + "994k634".replace(re53, ""); + "994k634".replace(re39, ""); + "994k634".replace(re54, ""); + "?zxg=ra-HF".replace(re40, ""); + "?zxg=ra-HF".replace(re10, ""); + "?zxg=ra-HF".replace(re51, ""); + "?zxg=ra-HF".replace(re52, ""); + "?zxg=ra-HF".replace(re53, ""); + "?zxg=ra-HF".replace(re54, ""); + "PAA.pbz".replace(re25, ""); + "PAA.pbz".replace(re12, ""); + "PAA.pbz".replace(re39, ""); + "Qngr & Gvzr".replace(re25, ""); + "Qngr & Gvzr".replace(re12, ""); + "Qngr & Gvzr".replace(re39, ""); + "Frnepu Zvpebfbsg.pbz".replace(re40, ""); + "Frnepu Zvpebfbsg.pbz".replace(re54, ""); + str67.replace(re10, ""); + str67.replace(re51, ""); + str67.replace(re52, ""); + str67.replace(re53, ""); + str67.replace(re39, ""); str68.split(re32); str69.split(re32); - str70.replace(re52, ''); - str70.replace(re53, ''); - str70.replace(re39, ''); - str71.replace(re40, ''); - str71.replace(re10, ''); - str71.replace(re51, ''); - str71.replace(re54, ''); - 'Jrngure'.replace(re25, ''); - 'Jrngure'.replace(re12, ''); - 'Jrngure'.replace(re39, ''); - 'LbhGhor'.replace(re25, ''); - 'LbhGhor'.replace(re12, ''); - 'LbhGhor'.replace(re39, ''); - str72.replace(re33, ''); - 'erzbgr_vsenzr_1'.replace(/^erzbgr_vsenzr_/, ''); - str73.replace(re40, ''); - str73.replace(re10, ''); - str73.replace(re51, ''); - str73.replace(re52, ''); - str73.replace(re53, ''); - str73.replace(re39, ''); - str73.replace(re54, ''); - str74.replace(re40, ''); - str74.replace(re10, ''); - str74.replace(re51, ''); - str74.replace(re52, ''); - str74.replace(re53, ''); - str74.replace(re39, ''); - str74.replace(re54, ''); - 'lhv-h'.replace(/\-/g, ''); - re9.exec('p'); - re9.exec('qz p'); - re9.exec('zbqynory'); - re9.exec('lhv-h svefg'); - re8.exec('144631658.0.10.1231365779'); - re8.exec('144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); - re8.exec('144631658.1877536177953918500.1231365779.1231365779.1231365779.1'); + str70.replace(re52, ""); + str70.replace(re53, ""); + str70.replace(re39, ""); + str71.replace(re40, ""); + str71.replace(re10, ""); + str71.replace(re51, ""); + str71.replace(re54, ""); + "Jrngure".replace(re25, ""); + "Jrngure".replace(re12, ""); + "Jrngure".replace(re39, ""); + "LbhGhor".replace(re25, ""); + "LbhGhor".replace(re12, ""); + "LbhGhor".replace(re39, ""); + str72.replace(re33, ""); + "erzbgr_vsenzr_1".replace(/^erzbgr_vsenzr_/, ""); + str73.replace(re40, ""); + str73.replace(re10, ""); + str73.replace(re51, ""); + str73.replace(re52, ""); + str73.replace(re53, ""); + str73.replace(re39, ""); + str73.replace(re54, ""); + str74.replace(re40, ""); + str74.replace(re10, ""); + str74.replace(re51, ""); + str74.replace(re52, ""); + str74.replace(re53, ""); + str74.replace(re39, ""); + str74.replace(re54, ""); + "lhv-h".replace(/\-/g, ""); + re9.exec("p"); + re9.exec("qz p"); + re9.exec("zbqynory"); + re9.exec("lhv-h svefg"); + re8.exec("144631658.0.10.1231365779"); + re8.exec( + "144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); + re8.exec( + "144631658.1877536177953918500.1231365779.1231365779.1231365779.1" + ); re8.exec(str75); re8.exec(str76); - re8.exec('__hgzn=144631658.1877536177953918500.1231365779.1231365779.1231365779.1'); - re8.exec('__hgzo=144631658.0.10.1231365779'); - re8.exec('__hgzm=144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec( + "__hgzn=144631658.1877536177953918500.1231365779.1231365779.1231365779.1" + ); + re8.exec("__hgzo=144631658.0.10.1231365779"); + re8.exec( + "__hgzm=144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); re34.exec(str68); re34.exec(str69); - /^$/.exec(''); - re31.exec('qr'); - /^znk\d+$/.exec(''); - /^zva\d+$/.exec(''); - /^erfgber$/.exec(''); - re85.exec('zbqobkva zbqobk_abcnqqvat '); - re85.exec('zbqgvgyr'); - re85.exec('eaq_zbqobkva '); - re85.exec('eaq_zbqgvgyr '); - /frpgvba\d+_pbagragf/.exec('obggbz_ani'); + /^$/.exec(""); + re31.exec("qr"); + /^znk\d+$/.exec(""); + /^zva\d+$/.exec(""); + /^erfgber$/.exec(""); + re85.exec("zbqobkva zbqobk_abcnqqvat "); + re85.exec("zbqgvgyr"); + re85.exec("eaq_zbqobkva "); + re85.exec("eaq_zbqgvgyr "); + /frpgvba\d+_pbagragf/.exec("obggbz_ani"); } } var re86 = /;\s*/; @@ -1295,450 +1478,503 @@ function RegExpBenchmark() { var re88 = /(\$\{abj\})|(\$abj\b)/g; var re89 = /\s+$/; var re90 = /^\s+/; - var re91 = /(\\\"|\x00-|\x1f|\x7f-|\x9f|\u00ad|\u0600-|\u0604|\u070f|\u17b4|\u17b5|\u200c-|\u200f|\u2028-|\u202f|\u2060-|\u206f|\ufeff|\ufff0-|\uffff)/g; + var re91 = + /(\\\"|\x00-|\x1f|\x7f-|\x9f|\u00ad|\u0600-|\u0604|\u070f|\u17b4|\u17b5|\u200c-|\u200f|\u2028-|\u202f|\u2060-|\u206f|\ufeff|\ufff0-|\uffff)/g; var re92 = /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/; var re93 = /^([:.#]*)((?:[\w\u0128-\uffff*_-]|\\.)+)/; var re94 = /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/; - var str77 = '#fubhgobk .pybfr'; - var str78 = 'FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669341278771470&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_dfctwzssrwh-aowb_80=441326q33660'; - var str79 = 'FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98; AFP_zp_dfctwzssrwh-aowb_80=441326q33660; __hgzm=144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1670816052019209000.1231365869.1231365869.1231365869.1; __hgzo=144631658.0.10.1231365869; __hgzp=144631658; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669341278771470&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str80 = 'FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669350559478880&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_dfctwzs-aowb_80=441327q73660'; - var str81 = 'FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473; AFP_zp_dfctwzs-aowb_80=441327q73660; __hgzm=144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1796080716621419500.1231367054.1231367054.1231367054.1; __hgzo=144631658.0.10.1231367054; __hgzp=144631658; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669350559478880&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str82 = '[glcr=fhozvg]'; - var str83 = 'n.svryqOga,n.svryqOgaPnapry'; - var str84 = 'n.svryqOgaPnapry'; - var str85 = 'oyvpxchaxg'; - var str86 = 'qvi.bow-nppbeqvba qg'; - var str87 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_nccf_wf&qg=1231367052227&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231367052227&punaary=svz_zlfcnpr_nccf-pnainf%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Scebsvyr.zlfcnpr.pbz%2SZbqhyrf%2SNccyvpngvbaf%2SCntrf%2SPnainf.nfck&nq_glcr=grkg&rvq=6083027&rn=0&sez=1&tn_ivq=716357910.1231367056&tn_fvq=1231367056&tn_uvq=1387206491&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; - var str88 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231365851658&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231365851658&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Scebsvyrrqvg.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1979828129.1231365855&tn_fvq=1231365855&tn_uvq=2085229649&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; - var str89 = 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55023338617756?[NDO]&aqu=1&g=7%2S0%2S2009%2014%3N12%3N47%203%20480&af=zfacbegny&cntrAnzr=HF%20UCZFSGJ&t=uggc%3N%2S%2Sjjj.zfa.pbz%2S&f=0k0&p=43835816&x=A&oj=994&ou=634&uc=A&{2}&[NDR]'; - var str90 = 'zrgn[anzr=nwnkHey]'; - var str91 = 'anpuevpugra'; - var str92 = 'b oS={\'oT\':1.1};x $8n(B){z(B!=o9)};x $S(B){O(!$8n(B))z A;O(B.4L)z\'T\';b S=7t B;O(S==\'2P\'&&B.p4){23(B.7f){12 1:z\'T\';12 3:z/\S/.2g(B.8M)?\'ox\':\'oh\'}}O(S==\'2P\'||S==\'x\'){23(B.nE){12 2V:z\'1O\';12 7I:z\'5a\';12 18:z\'4B\'}O(7t B.I==\'4F\'){O(B.3u)z\'pG\';O(B.8e)z\'1p\'}}z S};x $2p(){b 4E={};Z(b v=0;v<1p.I;v++){Z(b X 1o 1p[v]){b nc=1p[v][X];b 6E=4E[X];O(6E&&$S(nc)==\'2P\'&&$S(6E)==\'2P\')4E[X]=$2p(6E,nc);17 4E[X]=nc}}z 4E};b $E=7p.E=x(){b 1d=1p;O(!1d[1])1d=[p,1d[0]];Z(b X 1o 1d[1])1d[0][X]=1d[1][X];z 1d[0]};b $4D=7p.pJ=x(){Z(b v=0,y=1p.I;v-1:p.3F(2R)>-1},nX:x(){z p.3y(/([.*+?^${}()|[\]\/\\])/t,\'\\$1\')}});2V.E({5V:x(1O){O(p.I<3)z A;O(p.I==4&&p[3]==0&&!1O)z\'p5\';b 3P=[];Z(b v=0;v<3;v++){b 52=(p[v]-0).4h(16);3P.1x((52.I==1)?\'0\'+52:52)}z 1O?3P:\'#\'+3P.2u(\'\')},5U:x(1O){O(p.I!=3)z A;b 1i=[];Z(b v=0;v<3;v++){1i.1x(5K((p[v].I==1)?p[v]+p[v]:p[v],16))}z 1O?1i:\'1i(\'+1i.2u(\',\')+\')\'}});7F.E({3n:x(P){b J=p;P=$2p({\'L\':J,\'V\':A,\'1p\':1S,\'2x\':A,\'4s\':A,\'6W\':A},P);O($2O(P.1p)&&$S(P.1p)!=\'1O\')P.1p=[P.1p];z x(V){b 1d;O(P.V){V=V||H.V;1d=[(P.V===1r)?V:Y P.V(V)];O(P.1p)1d.E(P.1p)}17 1d=P.1p||1p;b 3C=x(){z J.3H($5S(P'; - var str93 = 'hagreunyghat'; - var str94 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669341278771470&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str95 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669350559478880&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; - var str96 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669341278771470&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; - var str97 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669350559478880&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; - var str98 = 'shapgvba (){Cuk.Nccyvpngvba.Frghc.Pber();Cuk.Nccyvpngvba.Frghc.Nwnk();Cuk.Nccyvpngvba.Frghc.Synfu();Cuk.Nccyvpngvba.Frghc.Zbqhyrf()}'; + var str77 = "#fubhgobk .pybfr"; + var str78 = + "FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669341278771470&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_dfctwzssrwh-aowb_80=441326q33660"; + var str79 = + "FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98; AFP_zp_dfctwzssrwh-aowb_80=441326q33660; __hgzm=144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1670816052019209000.1231365869.1231365869.1231365869.1; __hgzo=144631658.0.10.1231365869; __hgzp=144631658; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669341278771470&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str80 = + "FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669350559478880&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_dfctwzs-aowb_80=441327q73660"; + var str81 = + "FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473; AFP_zp_dfctwzs-aowb_80=441327q73660; __hgzm=144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1796080716621419500.1231367054.1231367054.1231367054.1; __hgzo=144631658.0.10.1231367054; __hgzp=144631658; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669350559478880&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str82 = "[glcr=fhozvg]"; + var str83 = "n.svryqOga,n.svryqOgaPnapry"; + var str84 = "n.svryqOgaPnapry"; + var str85 = "oyvpxchaxg"; + var str86 = "qvi.bow-nppbeqvba qg"; + var str87 = + "uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_nccf_wf&qg=1231367052227&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231367052227&punaary=svz_zlfcnpr_nccf-pnainf%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Scebsvyr.zlfcnpr.pbz%2SZbqhyrf%2SNccyvpngvbaf%2SCntrf%2SPnainf.nfck&nq_glcr=grkg&rvq=6083027&rn=0&sez=1&tn_ivq=716357910.1231367056&tn_fvq=1231367056&tn_uvq=1387206491&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22"; + var str88 = + "uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231365851658&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231365851658&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Scebsvyrrqvg.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1979828129.1231365855&tn_fvq=1231365855&tn_uvq=2085229649&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22"; + var str89 = + "uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55023338617756?[NDO]&aqu=1&g=7%2S0%2S2009%2014%3N12%3N47%203%20480&af=zfacbegny&cntrAnzr=HF%20UCZFSGJ&t=uggc%3N%2S%2Sjjj.zfa.pbz%2S&f=0k0&p=43835816&x=A&oj=994&ou=634&uc=A&{2}&[NDR]"; + var str90 = "zrgn[anzr=nwnkHey]"; + var str91 = "anpuevpugra"; + var str92 = + "b oS={'oT':1.1};x $8n(B){z(B!=o9)};x $S(B){O(!$8n(B))z A;O(B.4L)z'T';b S=7t B;O(S=='2P'&&B.p4){23(B.7f){12 1:z'T';12 3:z/S/.2g(B.8M)?'ox':'oh'}}O(S=='2P'||S=='x'){23(B.nE){12 2V:z'1O';12 7I:z'5a';12 18:z'4B'}O(7t B.I=='4F'){O(B.3u)z'pG';O(B.8e)z'1p'}}z S};x $2p(){b 4E={};Z(b v=0;v<1p.I;v++){Z(b X 1o 1p[v]){b nc=1p[v][X];b 6E=4E[X];O(6E&&$S(nc)=='2P'&&$S(6E)=='2P')4E[X]=$2p(6E,nc);17 4E[X]=nc}}z 4E};b $E=7p.E=x(){b 1d=1p;O(!1d[1])1d=[p,1d[0]];Z(b X 1o 1d[1])1d[0][X]=1d[1][X];z 1d[0]};b $4D=7p.pJ=x(){Z(b v=0,y=1p.I;v-1:p.3F(2R)>-1},nX:x(){z p.3y(/([.*+?^${}()|[]/\\])/t,'\\$1')}});2V.E({5V:x(1O){O(p.I<3)z A;O(p.I==4&&p[3]==0&&!1O)z'p5';b 3P=[];Z(b v=0;v<3;v++){b 52=(p[v]-0).4h(16);3P.1x((52.I==1)?'0'+52:52)}z 1O?3P:'#'+3P.2u('')},5U:x(1O){O(p.I!=3)z A;b 1i=[];Z(b v=0;v<3;v++){1i.1x(5K((p[v].I==1)?p[v]+p[v]:p[v],16))}z 1O?1i:'1i('+1i.2u(',')+')'}});7F.E({3n:x(P){b J=p;P=$2p({'L':J,'V':A,'1p':1S,'2x':A,'4s':A,'6W':A},P);O($2O(P.1p)&&$S(P.1p)!='1O')P.1p=[P.1p];z x(V){b 1d;O(P.V){V=V||H.V;1d=[(P.V===1r)?V:Y P.V(V)];O(P.1p)1d.E(P.1p)}17 1d=P.1p||1p;b 3C=x(){z J.3H($5S(P"; + var str93 = "hagreunyghat"; + var str94 = + "ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669341278771470&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str95 = + "ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669350559478880&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q"; + var str96 = + "ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669341278771470&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R="; + var str97 = + "ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669350559478880&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R="; + var str98 = + "shapgvba (){Cuk.Nccyvpngvba.Frghc.Pber();Cuk.Nccyvpngvba.Frghc.Nwnk();Cuk.Nccyvpngvba.Frghc.Synfu();Cuk.Nccyvpngvba.Frghc.Zbqhyrf()}"; function runBlock11() { for (var i = 0; i < 2; i++) { - ' .pybfr'.replace(re18, ''); - ' n.svryqOgaPnapry'.replace(re18, ''); - ' qg'.replace(re18, ''); - str77.replace(re68, ''); - str77.replace(re18, ''); - ''.replace(re39, ''); - ''.replace(/^/, ''); - ''.split(re86); - '*'.replace(re39, ''); - '*'.replace(re68, ''); - '*'.replace(re18, ''); - '.pybfr'.replace(re68, ''); - '.pybfr'.replace(re18, ''); - '//vzt.jro.qr/vij/FC/tzk_uc/fperra/${inyhr}?gf=${abj}'.replace(re87, ''); - '//vzt.jro.qr/vij/FC/tzk_uc/fperra/1024?gf=${abj}'.replace(re88, ''); - '//vzt.jro.qr/vij/FC/tzk_uc/jvafvmr/${inyhr}?gf=${abj}'.replace(re87, ''); - '//vzt.jro.qr/vij/FC/tzk_uc/jvafvmr/992/608?gf=${abj}'.replace(re88, ''); - '300k120'.replace(re30, ''); - '300k250'.replace(re30, ''); - '310k120'.replace(re30, ''); - '310k170'.replace(re30, ''); - '310k250'.replace(re30, ''); - '9.0 e115'.replace(/^.*\.(.*)\s.*$/, ''); - 'Nppbeqvba'.replace(re2, ''); - 'Nxghryy\x0a'.replace(re89, ''); - 'Nxghryy\x0a'.replace(re90, ''); - 'Nccyvpngvba'.replace(re2, ''); - 'Oyvpxchaxg\x0a'.replace(re89, ''); - 'Oyvpxchaxg\x0a'.replace(re90, ''); - 'Svanamra\x0a'.replace(re89, ''); - 'Svanamra\x0a'.replace(re90, ''); - 'Tnzrf\x0a'.replace(re89, ''); - 'Tnzrf\x0a'.replace(re90, ''); - 'Ubebfxbc\x0a'.replace(re89, ''); - 'Ubebfxbc\x0a'.replace(re90, ''); - 'Xvab\x0a'.replace(re89, ''); - 'Xvab\x0a'.replace(re90, ''); - 'Zbqhyrf'.replace(re2, ''); - 'Zhfvx\x0a'.replace(re89, ''); - 'Zhfvx\x0a'.replace(re90, ''); - 'Anpuevpugra\x0a'.replace(re89, ''); - 'Anpuevpugra\x0a'.replace(re90, ''); - 'Cuk'.replace(re2, ''); - 'ErdhrfgSvavfu'.split(re70); - 'ErdhrfgSvavfu.NWNK.Cuk'.split(re70); - 'Ebhgr\x0a'.replace(re89, ''); - 'Ebhgr\x0a'.replace(re90, ''); + " .pybfr".replace(re18, ""); + " n.svryqOgaPnapry".replace(re18, ""); + " qg".replace(re18, ""); + str77.replace(re68, ""); + str77.replace(re18, ""); + "".replace(re39, ""); + "".replace(/^/, ""); + "".split(re86); + "*".replace(re39, ""); + "*".replace(re68, ""); + "*".replace(re18, ""); + ".pybfr".replace(re68, ""); + ".pybfr".replace(re18, ""); + "//vzt.jro.qr/vij/FC/tzk_uc/fperra/${inyhr}?gf=${abj}".replace(re87, ""); + "//vzt.jro.qr/vij/FC/tzk_uc/fperra/1024?gf=${abj}".replace(re88, ""); + "//vzt.jro.qr/vij/FC/tzk_uc/jvafvmr/${inyhr}?gf=${abj}".replace(re87, ""); + "//vzt.jro.qr/vij/FC/tzk_uc/jvafvmr/992/608?gf=${abj}".replace(re88, ""); + "300k120".replace(re30, ""); + "300k250".replace(re30, ""); + "310k120".replace(re30, ""); + "310k170".replace(re30, ""); + "310k250".replace(re30, ""); + "9.0 e115".replace(/^.*\.(.*)\s.*$/, ""); + "Nppbeqvba".replace(re2, ""); + "Nxghryy\x0a".replace(re89, ""); + "Nxghryy\x0a".replace(re90, ""); + "Nccyvpngvba".replace(re2, ""); + "Oyvpxchaxg\x0a".replace(re89, ""); + "Oyvpxchaxg\x0a".replace(re90, ""); + "Svanamra\x0a".replace(re89, ""); + "Svanamra\x0a".replace(re90, ""); + "Tnzrf\x0a".replace(re89, ""); + "Tnzrf\x0a".replace(re90, ""); + "Ubebfxbc\x0a".replace(re89, ""); + "Ubebfxbc\x0a".replace(re90, ""); + "Xvab\x0a".replace(re89, ""); + "Xvab\x0a".replace(re90, ""); + "Zbqhyrf".replace(re2, ""); + "Zhfvx\x0a".replace(re89, ""); + "Zhfvx\x0a".replace(re90, ""); + "Anpuevpugra\x0a".replace(re89, ""); + "Anpuevpugra\x0a".replace(re90, ""); + "Cuk".replace(re2, ""); + "ErdhrfgSvavfu".split(re70); + "ErdhrfgSvavfu.NWNK.Cuk".split(re70); + "Ebhgr\x0a".replace(re89, ""); + "Ebhgr\x0a".replace(re90, ""); str78.split(re32); str79.split(re32); str80.split(re32); str81.split(re32); - 'Fcbeg\x0a'.replace(re89, ''); - 'Fcbeg\x0a'.replace(re90, ''); - 'GI-Fcbg\x0a'.replace(re89, ''); - 'GI-Fcbg\x0a'.replace(re90, ''); - 'Gbhe\x0a'.replace(re89, ''); - 'Gbhe\x0a'.replace(re90, ''); - 'Hagreunyghat\x0a'.replace(re89, ''); - 'Hagreunyghat\x0a'.replace(re90, ''); - 'Ivqrb\x0a'.replace(re89, ''); - 'Ivqrb\x0a'.replace(re90, ''); - 'Jrggre\x0a'.replace(re89, ''); - 'Jrggre\x0a'.replace(re90, ''); - str82.replace(re68, ''); - str82.replace(re18, ''); - str83.replace(re68, ''); - str83.replace(re18, ''); - str84.replace(re68, ''); - str84.replace(re18, ''); - 'nqiFreivprObk'.replace(re30, ''); - 'nqiFubccvatObk'.replace(re30, ''); - 'nwnk'.replace(re39, ''); - 'nxghryy'.replace(re40, ''); - 'nxghryy'.replace(re41, ''); - 'nxghryy'.replace(re42, ''); - 'nxghryy'.replace(re43, ''); - 'nxghryy'.replace(re44, ''); - 'nxghryy'.replace(re45, ''); - 'nxghryy'.replace(re46, ''); - 'nxghryy'.replace(re47, ''); - 'nxghryy'.replace(re48, ''); - str85.replace(re40, ''); - str85.replace(re41, ''); - str85.replace(re42, ''); - str85.replace(re43, ''); - str85.replace(re44, ''); - str85.replace(re45, ''); - str85.replace(re46, ''); - str85.replace(re47, ''); - str85.replace(re48, ''); - 'pngrtbel'.replace(re29, ''); - 'pngrtbel'.replace(re30, ''); - 'pybfr'.replace(re39, ''); - 'qvi'.replace(re39, ''); - str86.replace(re68, ''); - str86.replace(re18, ''); - 'qg'.replace(re39, ''); - 'qg'.replace(re68, ''); - 'qg'.replace(re18, ''); - 'rzorq'.replace(re39, ''); - 'rzorq'.replace(re68, ''); - 'rzorq'.replace(re18, ''); - 'svryqOga'.replace(re39, ''); - 'svryqOgaPnapry'.replace(re39, ''); - 'svz_zlfcnpr_nccf-pnainf,svz_zlfcnpr_havgrq-fgngrf'.split(re20); - 'svanamra'.replace(re40, ''); - 'svanamra'.replace(re41, ''); - 'svanamra'.replace(re42, ''); - 'svanamra'.replace(re43, ''); - 'svanamra'.replace(re44, ''); - 'svanamra'.replace(re45, ''); - 'svanamra'.replace(re46, ''); - 'svanamra'.replace(re47, ''); - 'svanamra'.replace(re48, ''); - 'sbphf'.split(re70); - 'sbphf.gno sbphfva.gno'.split(re70); - 'sbphfva'.split(re70); - 'sbez'.replace(re39, ''); - 'sbez.nwnk'.replace(re68, ''); - 'sbez.nwnk'.replace(re18, ''); - 'tnzrf'.replace(re40, ''); - 'tnzrf'.replace(re41, ''); - 'tnzrf'.replace(re42, ''); - 'tnzrf'.replace(re43, ''); - 'tnzrf'.replace(re44, ''); - 'tnzrf'.replace(re45, ''); - 'tnzrf'.replace(re46, ''); - 'tnzrf'.replace(re47, ''); - 'tnzrf'.replace(re48, ''); - 'ubzrcntr'.replace(re30, ''); - 'ubebfxbc'.replace(re40, ''); - 'ubebfxbc'.replace(re41, ''); - 'ubebfxbc'.replace(re42, ''); - 'ubebfxbc'.replace(re43, ''); - 'ubebfxbc'.replace(re44, ''); - 'ubebfxbc'.replace(re45, ''); - 'ubebfxbc'.replace(re46, ''); - 'ubebfxbc'.replace(re47, ''); - 'ubebfxbc'.replace(re48, ''); - 'uc_cebzbobk_ugzy%2Puc_cebzbobk_vzt'.replace(re30, ''); - 'uc_erpgnatyr'.replace(re30, ''); - str87.replace(re33, ''); - str88.replace(re33, ''); - 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf${4}${5}'.replace(re71, ''); - 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf${5}'.replace(re72, ''); - 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/qlaYvo.wf${4}${5}'.replace(re71, ''); - 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/qlaYvo.wf${5}'.replace(re72, ''); - 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/rssrpgYvo.wf${4}${5}'.replace(re71, ''); - 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/rssrpgYvo.wf${5}'.replace(re72, ''); - str89.replace(re73, ''); - 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55023338617756?[NDO]&{1}&{2}&[NDR]'.replace(re69, ''); - str6.replace(re23, ''); - 'xvab'.replace(re40, ''); - 'xvab'.replace(re41, ''); - 'xvab'.replace(re42, ''); - 'xvab'.replace(re43, ''); - 'xvab'.replace(re44, ''); - 'xvab'.replace(re45, ''); - 'xvab'.replace(re46, ''); - 'xvab'.replace(re47, ''); - 'xvab'.replace(re48, ''); - 'ybnq'.split(re70); - 'zrqvnzbqgno lhv-anifrg lhv-anifrg-gbc'.replace(re18, ''); - 'zrgn'.replace(re39, ''); - str90.replace(re68, ''); - str90.replace(re18, ''); - 'zbhfrzbir'.split(re70); - 'zbhfrzbir.gno'.split(re70); - str63.replace(/^.*jroxvg\/(\d+(\.\d+)?).*$/, ''); - 'zhfvx'.replace(re40, ''); - 'zhfvx'.replace(re41, ''); - 'zhfvx'.replace(re42, ''); - 'zhfvx'.replace(re43, ''); - 'zhfvx'.replace(re44, ''); - 'zhfvx'.replace(re45, ''); - 'zhfvx'.replace(re46, ''); - 'zhfvx'.replace(re47, ''); - 'zhfvx'.replace(re48, ''); - 'zlfcnpr_nccf_pnainf'.replace(re52, ''); - str91.replace(re40, ''); - str91.replace(re41, ''); - str91.replace(re42, ''); - str91.replace(re43, ''); - str91.replace(re44, ''); - str91.replace(re45, ''); - str91.replace(re46, ''); - str91.replace(re47, ''); - str91.replace(re48, ''); - 'anzr'.replace(re39, ''); - str92.replace(/\b\w+\b/g, ''); - 'bow-nppbeqvba'.replace(re39, ''); - 'bowrpg'.replace(re39, ''); - 'bowrpg'.replace(re68, ''); - 'bowrpg'.replace(re18, ''); - 'cnenzf%2Rfglyrf'.replace(re29, ''); - 'cnenzf%2Rfglyrf'.replace(re30, ''); - 'cbchc'.replace(re30, ''); - 'ebhgr'.replace(re40, ''); - 'ebhgr'.replace(re41, ''); - 'ebhgr'.replace(re42, ''); - 'ebhgr'.replace(re43, ''); - 'ebhgr'.replace(re44, ''); - 'ebhgr'.replace(re45, ''); - 'ebhgr'.replace(re46, ''); - 'ebhgr'.replace(re47, ''); - 'ebhgr'.replace(re48, ''); - 'freivprobk_uc'.replace(re30, ''); - 'fubccvatobk_uc'.replace(re30, ''); - 'fubhgobk'.replace(re39, ''); - 'fcbeg'.replace(re40, ''); - 'fcbeg'.replace(re41, ''); - 'fcbeg'.replace(re42, ''); - 'fcbeg'.replace(re43, ''); - 'fcbeg'.replace(re44, ''); - 'fcbeg'.replace(re45, ''); - 'fcbeg'.replace(re46, ''); - 'fcbeg'.replace(re47, ''); - 'fcbeg'.replace(re48, ''); - 'gbhe'.replace(re40, ''); - 'gbhe'.replace(re41, ''); - 'gbhe'.replace(re42, ''); - 'gbhe'.replace(re43, ''); - 'gbhe'.replace(re44, ''); - 'gbhe'.replace(re45, ''); - 'gbhe'.replace(re46, ''); - 'gbhe'.replace(re47, ''); - 'gbhe'.replace(re48, ''); - 'gi-fcbg'.replace(re40, ''); - 'gi-fcbg'.replace(re41, ''); - 'gi-fcbg'.replace(re42, ''); - 'gi-fcbg'.replace(re43, ''); - 'gi-fcbg'.replace(re44, ''); - 'gi-fcbg'.replace(re45, ''); - 'gi-fcbg'.replace(re46, ''); - 'gi-fcbg'.replace(re47, ''); - 'gi-fcbg'.replace(re48, ''); - 'glcr'.replace(re39, ''); - 'haqrsvarq'.replace(/\//g, ''); - str93.replace(re40, ''); - str93.replace(re41, ''); - str93.replace(re42, ''); - str93.replace(re43, ''); - str93.replace(re44, ''); - str93.replace(re45, ''); - str93.replace(re46, ''); - str93.replace(re47, ''); - str93.replace(re48, ''); - 'ivqrb'.replace(re40, ''); - 'ivqrb'.replace(re41, ''); - 'ivqrb'.replace(re42, ''); - 'ivqrb'.replace(re43, ''); - 'ivqrb'.replace(re44, ''); - 'ivqrb'.replace(re45, ''); - 'ivqrb'.replace(re46, ''); - 'ivqrb'.replace(re47, ''); - 'ivqrb'.replace(re48, ''); - 'ivfvgf=1'.split(re86); - 'jrggre'.replace(re40, ''); - 'jrggre'.replace(re41, ''); - 'jrggre'.replace(re42, ''); - 'jrggre'.replace(re43, ''); - 'jrggre'.replace(re44, ''); - 'jrggre'.replace(re45, ''); - 'jrggre'.replace(re46, ''); - 'jrggre'.replace(re47, ''); - 'jrggre'.replace(re48, ''); - /#[a-z0-9]+$/i.exec('uggc://jjj.fpuhryreim.arg/Qrsnhyg'); - re66.exec('fryrpgrq'); - /(?:^|\s+)lhv-ani(?:\s+|$)/.exec('sff lhv-ani'); - /(?:^|\s+)lhv-anifrg(?:\s+|$)/.exec('zrqvnzbqgno lhv-anifrg'); - /(?:^|\s+)lhv-anifrg-gbc(?:\s+|$)/.exec('zrqvnzbqgno lhv-anifrg'); - re91.exec('GnoThvq'); - re91.exec('thvq'); + "Fcbeg\x0a".replace(re89, ""); + "Fcbeg\x0a".replace(re90, ""); + "GI-Fcbg\x0a".replace(re89, ""); + "GI-Fcbg\x0a".replace(re90, ""); + "Gbhe\x0a".replace(re89, ""); + "Gbhe\x0a".replace(re90, ""); + "Hagreunyghat\x0a".replace(re89, ""); + "Hagreunyghat\x0a".replace(re90, ""); + "Ivqrb\x0a".replace(re89, ""); + "Ivqrb\x0a".replace(re90, ""); + "Jrggre\x0a".replace(re89, ""); + "Jrggre\x0a".replace(re90, ""); + str82.replace(re68, ""); + str82.replace(re18, ""); + str83.replace(re68, ""); + str83.replace(re18, ""); + str84.replace(re68, ""); + str84.replace(re18, ""); + "nqiFreivprObk".replace(re30, ""); + "nqiFubccvatObk".replace(re30, ""); + "nwnk".replace(re39, ""); + "nxghryy".replace(re40, ""); + "nxghryy".replace(re41, ""); + "nxghryy".replace(re42, ""); + "nxghryy".replace(re43, ""); + "nxghryy".replace(re44, ""); + "nxghryy".replace(re45, ""); + "nxghryy".replace(re46, ""); + "nxghryy".replace(re47, ""); + "nxghryy".replace(re48, ""); + str85.replace(re40, ""); + str85.replace(re41, ""); + str85.replace(re42, ""); + str85.replace(re43, ""); + str85.replace(re44, ""); + str85.replace(re45, ""); + str85.replace(re46, ""); + str85.replace(re47, ""); + str85.replace(re48, ""); + "pngrtbel".replace(re29, ""); + "pngrtbel".replace(re30, ""); + "pybfr".replace(re39, ""); + "qvi".replace(re39, ""); + str86.replace(re68, ""); + str86.replace(re18, ""); + "qg".replace(re39, ""); + "qg".replace(re68, ""); + "qg".replace(re18, ""); + "rzorq".replace(re39, ""); + "rzorq".replace(re68, ""); + "rzorq".replace(re18, ""); + "svryqOga".replace(re39, ""); + "svryqOgaPnapry".replace(re39, ""); + "svz_zlfcnpr_nccf-pnainf,svz_zlfcnpr_havgrq-fgngrf".split(re20); + "svanamra".replace(re40, ""); + "svanamra".replace(re41, ""); + "svanamra".replace(re42, ""); + "svanamra".replace(re43, ""); + "svanamra".replace(re44, ""); + "svanamra".replace(re45, ""); + "svanamra".replace(re46, ""); + "svanamra".replace(re47, ""); + "svanamra".replace(re48, ""); + "sbphf".split(re70); + "sbphf.gno sbphfva.gno".split(re70); + "sbphfva".split(re70); + "sbez".replace(re39, ""); + "sbez.nwnk".replace(re68, ""); + "sbez.nwnk".replace(re18, ""); + "tnzrf".replace(re40, ""); + "tnzrf".replace(re41, ""); + "tnzrf".replace(re42, ""); + "tnzrf".replace(re43, ""); + "tnzrf".replace(re44, ""); + "tnzrf".replace(re45, ""); + "tnzrf".replace(re46, ""); + "tnzrf".replace(re47, ""); + "tnzrf".replace(re48, ""); + "ubzrcntr".replace(re30, ""); + "ubebfxbc".replace(re40, ""); + "ubebfxbc".replace(re41, ""); + "ubebfxbc".replace(re42, ""); + "ubebfxbc".replace(re43, ""); + "ubebfxbc".replace(re44, ""); + "ubebfxbc".replace(re45, ""); + "ubebfxbc".replace(re46, ""); + "ubebfxbc".replace(re47, ""); + "ubebfxbc".replace(re48, ""); + "uc_cebzbobk_ugzy%2Puc_cebzbobk_vzt".replace(re30, ""); + "uc_erpgnatyr".replace(re30, ""); + str87.replace(re33, ""); + str88.replace(re33, ""); + "uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf${4}${5}".replace( + re71, + "" + ); + "uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf${5}".replace( + re72, + "" + ); + "uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/qlaYvo.wf${4}${5}".replace( + re71, + "" + ); + "uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/qlaYvo.wf${5}".replace( + re72, + "" + ); + "uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/rssrpgYvo.wf${4}${5}".replace( + re71, + "" + ); + "uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/rssrpgYvo.wf${5}".replace( + re72, + "" + ); + str89.replace(re73, ""); + "uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55023338617756?[NDO]&{1}&{2}&[NDR]".replace( + re69, + "" + ); + str6.replace(re23, ""); + "xvab".replace(re40, ""); + "xvab".replace(re41, ""); + "xvab".replace(re42, ""); + "xvab".replace(re43, ""); + "xvab".replace(re44, ""); + "xvab".replace(re45, ""); + "xvab".replace(re46, ""); + "xvab".replace(re47, ""); + "xvab".replace(re48, ""); + "ybnq".split(re70); + "zrqvnzbqgno lhv-anifrg lhv-anifrg-gbc".replace(re18, ""); + "zrgn".replace(re39, ""); + str90.replace(re68, ""); + str90.replace(re18, ""); + "zbhfrzbir".split(re70); + "zbhfrzbir.gno".split(re70); + str63.replace(/^.*jroxvg\/(\d+(\.\d+)?).*$/, ""); + "zhfvx".replace(re40, ""); + "zhfvx".replace(re41, ""); + "zhfvx".replace(re42, ""); + "zhfvx".replace(re43, ""); + "zhfvx".replace(re44, ""); + "zhfvx".replace(re45, ""); + "zhfvx".replace(re46, ""); + "zhfvx".replace(re47, ""); + "zhfvx".replace(re48, ""); + "zlfcnpr_nccf_pnainf".replace(re52, ""); + str91.replace(re40, ""); + str91.replace(re41, ""); + str91.replace(re42, ""); + str91.replace(re43, ""); + str91.replace(re44, ""); + str91.replace(re45, ""); + str91.replace(re46, ""); + str91.replace(re47, ""); + str91.replace(re48, ""); + "anzr".replace(re39, ""); + str92.replace(/\b\w+\b/g, ""); + "bow-nppbeqvba".replace(re39, ""); + "bowrpg".replace(re39, ""); + "bowrpg".replace(re68, ""); + "bowrpg".replace(re18, ""); + "cnenzf%2Rfglyrf".replace(re29, ""); + "cnenzf%2Rfglyrf".replace(re30, ""); + "cbchc".replace(re30, ""); + "ebhgr".replace(re40, ""); + "ebhgr".replace(re41, ""); + "ebhgr".replace(re42, ""); + "ebhgr".replace(re43, ""); + "ebhgr".replace(re44, ""); + "ebhgr".replace(re45, ""); + "ebhgr".replace(re46, ""); + "ebhgr".replace(re47, ""); + "ebhgr".replace(re48, ""); + "freivprobk_uc".replace(re30, ""); + "fubccvatobk_uc".replace(re30, ""); + "fubhgobk".replace(re39, ""); + "fcbeg".replace(re40, ""); + "fcbeg".replace(re41, ""); + "fcbeg".replace(re42, ""); + "fcbeg".replace(re43, ""); + "fcbeg".replace(re44, ""); + "fcbeg".replace(re45, ""); + "fcbeg".replace(re46, ""); + "fcbeg".replace(re47, ""); + "fcbeg".replace(re48, ""); + "gbhe".replace(re40, ""); + "gbhe".replace(re41, ""); + "gbhe".replace(re42, ""); + "gbhe".replace(re43, ""); + "gbhe".replace(re44, ""); + "gbhe".replace(re45, ""); + "gbhe".replace(re46, ""); + "gbhe".replace(re47, ""); + "gbhe".replace(re48, ""); + "gi-fcbg".replace(re40, ""); + "gi-fcbg".replace(re41, ""); + "gi-fcbg".replace(re42, ""); + "gi-fcbg".replace(re43, ""); + "gi-fcbg".replace(re44, ""); + "gi-fcbg".replace(re45, ""); + "gi-fcbg".replace(re46, ""); + "gi-fcbg".replace(re47, ""); + "gi-fcbg".replace(re48, ""); + "glcr".replace(re39, ""); + "haqrsvarq".replace(/\//g, ""); + str93.replace(re40, ""); + str93.replace(re41, ""); + str93.replace(re42, ""); + str93.replace(re43, ""); + str93.replace(re44, ""); + str93.replace(re45, ""); + str93.replace(re46, ""); + str93.replace(re47, ""); + str93.replace(re48, ""); + "ivqrb".replace(re40, ""); + "ivqrb".replace(re41, ""); + "ivqrb".replace(re42, ""); + "ivqrb".replace(re43, ""); + "ivqrb".replace(re44, ""); + "ivqrb".replace(re45, ""); + "ivqrb".replace(re46, ""); + "ivqrb".replace(re47, ""); + "ivqrb".replace(re48, ""); + "ivfvgf=1".split(re86); + "jrggre".replace(re40, ""); + "jrggre".replace(re41, ""); + "jrggre".replace(re42, ""); + "jrggre".replace(re43, ""); + "jrggre".replace(re44, ""); + "jrggre".replace(re45, ""); + "jrggre".replace(re46, ""); + "jrggre".replace(re47, ""); + "jrggre".replace(re48, ""); + /#[a-z0-9]+$/i.exec("uggc://jjj.fpuhryreim.arg/Qrsnhyg"); + re66.exec("fryrpgrq"); + /(?:^|\s+)lhv-ani(?:\s+|$)/.exec("sff lhv-ani"); + /(?:^|\s+)lhv-anifrg(?:\s+|$)/.exec("zrqvnzbqgno lhv-anifrg"); + /(?:^|\s+)lhv-anifrg-gbc(?:\s+|$)/.exec("zrqvnzbqgno lhv-anifrg"); + re91.exec("GnoThvq"); + re91.exec("thvq"); /(pbzcngvoyr|jroxvg)/.exec(str63); /.+(?:ei|vg|en|vr)[\/: ]([\d.]+)/.exec(str63); - re8.exec('144631658.0.10.1231365869'); - re8.exec('144631658.0.10.1231367054'); - re8.exec('144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); - re8.exec('144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); - re8.exec('144631658.1670816052019209000.1231365869.1231365869.1231365869.1'); - re8.exec('144631658.1796080716621419500.1231367054.1231367054.1231367054.1'); + re8.exec("144631658.0.10.1231365869"); + re8.exec("144631658.0.10.1231367054"); + re8.exec( + "144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); + re8.exec( + "144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); + re8.exec( + "144631658.1670816052019209000.1231365869.1231365869.1231365869.1" + ); + re8.exec( + "144631658.1796080716621419500.1231367054.1231367054.1231367054.1" + ); re8.exec(str94); re8.exec(str95); re8.exec(str96); re8.exec(str97); - re8.exec('__hgzn=144631658.1670816052019209000.1231365869.1231365869.1231365869.1'); - re8.exec('__hgzn=144631658.1796080716621419500.1231367054.1231367054.1231367054.1'); - re8.exec('__hgzo=144631658.0.10.1231365869'); - re8.exec('__hgzo=144631658.0.10.1231367054'); - re8.exec('__hgzm=144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); - re8.exec('__hgzm=144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); + re8.exec( + "__hgzn=144631658.1670816052019209000.1231365869.1231365869.1231365869.1" + ); + re8.exec( + "__hgzn=144631658.1796080716621419500.1231367054.1231367054.1231367054.1" + ); + re8.exec("__hgzo=144631658.0.10.1231365869"); + re8.exec("__hgzo=144631658.0.10.1231367054"); + re8.exec( + "__hgzm=144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); + re8.exec( + "__hgzm=144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)" + ); re34.exec(str78); re34.exec(str79); re34.exec(str81); re74.exec(str77); - re74.exec('*'); + re74.exec("*"); re74.exec(str82); re74.exec(str83); re74.exec(str86); - re74.exec('rzorq'); - re74.exec('sbez.nwnk'); + re74.exec("rzorq"); + re74.exec("sbez.nwnk"); re74.exec(str90); - re74.exec('bowrpg'); - /\/onfr.wf(\?.+)?$/.exec('/uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf'); - re28.exec('uvag ynfgUvag ynfg'); - re75.exec(''); - re76.exec(''); - re77.exec(''); - re78.exec(''); + re74.exec("bowrpg"); + /\/onfr.wf(\?.+)?$/.exec( + "/uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf" + ); + re28.exec("uvag ynfgUvag ynfg"); + re75.exec(""); + re76.exec(""); + re77.exec(""); + re78.exec(""); re80.exec(str77); - re80.exec('*'); - re80.exec('.pybfr'); + re80.exec("*"); + re80.exec(".pybfr"); re80.exec(str82); re80.exec(str83); re80.exec(str84); re80.exec(str86); - re80.exec('qg'); - re80.exec('rzorq'); - re80.exec('sbez.nwnk'); + re80.exec("qg"); + re80.exec("rzorq"); + re80.exec("sbez.nwnk"); re80.exec(str90); - re80.exec('bowrpg'); - re61.exec('qlaYvo.wf'); - re61.exec('rssrpgYvo.wf'); - re61.exec('uggc://jjj.tzk.arg/qr/?fgnghf=uvajrvf'); - re92.exec(' .pybfr'); - re92.exec(' n.svryqOgaPnapry'); - re92.exec(' qg'); + re80.exec("bowrpg"); + re61.exec("qlaYvo.wf"); + re61.exec("rssrpgYvo.wf"); + re61.exec("uggc://jjj.tzk.arg/qr/?fgnghf=uvajrvf"); + re92.exec(" .pybfr"); + re92.exec(" n.svryqOgaPnapry"); + re92.exec(" qg"); re92.exec(str48); - re92.exec('.nwnk'); - re92.exec('.svryqOga,n.svryqOgaPnapry'); - re92.exec('.svryqOgaPnapry'); - re92.exec('.bow-nppbeqvba qg'); + re92.exec(".nwnk"); + re92.exec(".svryqOga,n.svryqOgaPnapry"); + re92.exec(".svryqOgaPnapry"); + re92.exec(".bow-nppbeqvba qg"); re68.exec(str77); - re68.exec('*'); - re68.exec('.pybfr'); + re68.exec("*"); + re68.exec(".pybfr"); re68.exec(str82); re68.exec(str83); re68.exec(str84); re68.exec(str86); - re68.exec('qg'); - re68.exec('rzorq'); - re68.exec('sbez.nwnk'); + re68.exec("qg"); + re68.exec("rzorq"); + re68.exec("sbez.nwnk"); re68.exec(str90); - re68.exec('bowrpg'); - re93.exec(' .pybfr'); - re93.exec(' n.svryqOgaPnapry'); - re93.exec(' qg'); + re68.exec("bowrpg"); + re93.exec(" .pybfr"); + re93.exec(" n.svryqOgaPnapry"); + re93.exec(" qg"); re93.exec(str48); - re93.exec('.nwnk'); - re93.exec('.svryqOga,n.svryqOgaPnapry'); - re93.exec('.svryqOgaPnapry'); - re93.exec('.bow-nppbeqvba qg'); + re93.exec(".nwnk"); + re93.exec(".svryqOga,n.svryqOgaPnapry"); + re93.exec(".svryqOgaPnapry"); + re93.exec(".bow-nppbeqvba qg"); re81.exec(str77); - re81.exec('*'); + re81.exec("*"); re81.exec(str48); - re81.exec('.pybfr'); + re81.exec(".pybfr"); re81.exec(str82); re81.exec(str83); re81.exec(str84); re81.exec(str86); - re81.exec('qg'); - re81.exec('rzorq'); - re81.exec('sbez.nwnk'); + re81.exec("qg"); + re81.exec("rzorq"); + re81.exec("sbez.nwnk"); re81.exec(str90); - re81.exec('bowrpg'); - re94.exec(' .pybfr'); - re94.exec(' n.svryqOgaPnapry'); - re94.exec(' qg'); + re81.exec("bowrpg"); + re94.exec(" .pybfr"); + re94.exec(" n.svryqOgaPnapry"); + re94.exec(" qg"); re94.exec(str48); - re94.exec('.nwnk'); - re94.exec('.svryqOga,n.svryqOgaPnapry'); - re94.exec('.svryqOgaPnapry'); - re94.exec('.bow-nppbeqvba qg'); - re94.exec('[anzr=nwnkHey]'); + re94.exec(".nwnk"); + re94.exec(".svryqOga,n.svryqOgaPnapry"); + re94.exec(".svryqOgaPnapry"); + re94.exec(".bow-nppbeqvba qg"); + re94.exec("[anzr=nwnkHey]"); re94.exec(str82); - re31.exec('rf'); - re31.exec('wn'); + re31.exec("rf"); + re31.exec("wn"); re82.exec(str77); - re82.exec('*'); + re82.exec("*"); re82.exec(str48); - re82.exec('.pybfr'); + re82.exec(".pybfr"); re82.exec(str82); re82.exec(str83); re82.exec(str84); re82.exec(str86); - re82.exec('qg'); - re82.exec('rzorq'); - re82.exec('sbez.nwnk'); + re82.exec("qg"); + re82.exec("rzorq"); + re82.exec("sbez.nwnk"); re82.exec(str90); - re82.exec('bowrpg'); + re82.exec("bowrpg"); re83.exec(str98); - re83.exec('shapgvba sbphf() { [angvir pbqr] }'); - re62.exec('#Ybtva'); - re62.exec('#Ybtva_cnffjbeq'); + re83.exec("shapgvba sbphf() { [angvir pbqr] }"); + re62.exec("#Ybtva"); + re62.exec("#Ybtva_cnffjbeq"); re62.exec(str77); - re62.exec('#fubhgobkWf'); - re62.exec('#fubhgobkWfReebe'); - re62.exec('#fubhgobkWfFhpprff'); - re62.exec('*'); + re62.exec("#fubhgobkWf"); + re62.exec("#fubhgobkWfReebe"); + re62.exec("#fubhgobkWfFhpprff"); + re62.exec("*"); re62.exec(str82); re62.exec(str83); re62.exec(str86); - re62.exec('rzorq'); - re62.exec('sbez.nwnk'); + re62.exec("rzorq"); + re62.exec("sbez.nwnk"); re62.exec(str90); - re62.exec('bowrpg'); - re49.exec('pbagrag'); + re62.exec("bowrpg"); + re49.exec("pbagrag"); re24.exec(str6); /xbadhrebe/.exec(str63); - /znp/.exec('jva32'); + /znp/.exec("jva32"); /zbmvyyn/.exec(str63); /zfvr/.exec(str63); /ag\s5\.1/.exec(str63); /bcren/.exec(str63); /fnsnev/.exec(str63); - /jva/.exec('jva32'); + /jva/.exec("jva32"); /jvaqbjf/.exec(str63); } } diff --git a/benchmarks/v8-v7/richards.js b/benchmarks/v8-v7/richards.js index 054928db16..7731c02ec0 100644 --- a/benchmarks/v8-v7/richards.js +++ b/benchmarks/v8-v7/richards.js @@ -25,7 +25,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // This is a JavaScript implementation of the Richards // benchmark from: // @@ -34,12 +33,10 @@ // The benchmark was originally implemented in BCPL by // Martin Richards. - -var Richards = new BenchmarkSuite('Richards', 35302, [ - new Benchmark("Richards", runRichards) +var Richards = new BenchmarkSuite("Richards", 35302, [ + new Benchmark("Richards", runRichards), ]); - /** * The Richards benchmark simulates the task dispatcher of an * operating system. @@ -49,17 +46,17 @@ function runRichards() { scheduler.addIdleTask(ID_IDLE, 0, null, COUNT); var queue = new Packet(null, ID_WORKER, KIND_WORK); - queue = new Packet(queue, ID_WORKER, KIND_WORK); + queue = new Packet(queue, ID_WORKER, KIND_WORK); scheduler.addWorkerTask(ID_WORKER, 1000, queue); queue = new Packet(null, ID_DEVICE_A, KIND_DEVICE); - queue = new Packet(queue, ID_DEVICE_A, KIND_DEVICE); - queue = new Packet(queue, ID_DEVICE_A, KIND_DEVICE); + queue = new Packet(queue, ID_DEVICE_A, KIND_DEVICE); + queue = new Packet(queue, ID_DEVICE_A, KIND_DEVICE); scheduler.addHandlerTask(ID_HANDLER_A, 2000, queue); queue = new Packet(null, ID_DEVICE_B, KIND_DEVICE); - queue = new Packet(queue, ID_DEVICE_B, KIND_DEVICE); - queue = new Packet(queue, ID_DEVICE_B, KIND_DEVICE); + queue = new Packet(queue, ID_DEVICE_B, KIND_DEVICE); + queue = new Packet(queue, ID_DEVICE_B, KIND_DEVICE); scheduler.addHandlerTask(ID_HANDLER_B, 3000, queue); scheduler.addDeviceTask(ID_DEVICE_A, 4000, null); @@ -68,11 +65,16 @@ function runRichards() { scheduler.schedule(); - if (scheduler.queueCount != EXPECTED_QUEUE_COUNT || - scheduler.holdCount != EXPECTED_HOLD_COUNT) { + if ( + scheduler.queueCount != EXPECTED_QUEUE_COUNT || + scheduler.holdCount != EXPECTED_HOLD_COUNT + ) { var msg = - "Error during execution: queueCount = " + scheduler.queueCount + - ", holdCount = " + scheduler.holdCount + "."; + "Error during execution: queueCount = " + + scheduler.queueCount + + ", holdCount = " + + scheduler.holdCount + + "."; throw new Error(msg); } } @@ -89,7 +91,6 @@ var COUNT = 1000; var EXPECTED_QUEUE_COUNT = 2322; var EXPECTED_HOLD_COUNT = 928; - /** * A scheduler can be used to schedule a set of tasks based on their relative * priorities. Scheduling is done by maintaining a list of task control blocks @@ -105,16 +106,16 @@ function Scheduler() { this.currentId = null; } -var ID_IDLE = 0; -var ID_WORKER = 1; -var ID_HANDLER_A = 2; -var ID_HANDLER_B = 3; -var ID_DEVICE_A = 4; -var ID_DEVICE_B = 5; +var ID_IDLE = 0; +var ID_WORKER = 1; +var ID_HANDLER_A = 2; +var ID_HANDLER_B = 3; +var ID_DEVICE_A = 4; +var ID_DEVICE_B = 5; var NUMBER_OF_IDS = 6; -var KIND_DEVICE = 0; -var KIND_WORK = 1; +var KIND_DEVICE = 0; +var KIND_WORK = 1; /** * Add an idle task to this scheduler. @@ -154,7 +155,7 @@ Scheduler.prototype.addHandlerTask = function (id, priority, queue) { * @param {Packet} queue the queue of work to be processed by the task */ Scheduler.prototype.addDeviceTask = function (id, priority, queue) { - this.addTask(id, priority, queue, new DeviceTask(this)) + this.addTask(id, priority, queue, new DeviceTask(this)); }; /** @@ -282,7 +283,7 @@ var STATE_RUNNABLE = 1; /** * The task is not currently running. The task is not blocked as such and may -* be started by the scheduler. + * be started by the scheduler. */ var STATE_SUSPENDED = 2; @@ -307,7 +308,7 @@ TaskControlBlock.prototype.markAsHeld = function () { }; TaskControlBlock.prototype.isHeldOrSuspended = function () { - return (this.state & STATE_HELD) != 0 || (this.state == STATE_SUSPENDED); + return (this.state & STATE_HELD) != 0 || this.state == STATE_SUSPENDED; }; TaskControlBlock.prototype.markAsSuspended = function () { @@ -378,13 +379,13 @@ IdleTask.prototype.run = function (packet) { this.v1 = this.v1 >> 1; return this.scheduler.release(ID_DEVICE_A); } else { - this.v1 = (this.v1 >> 1) ^ 0xD008; + this.v1 = (this.v1 >> 1) ^ 0xd008; return this.scheduler.release(ID_DEVICE_B); } }; IdleTask.prototype.toString = function () { - return "IdleTask" + return "IdleTask"; }; /** @@ -527,9 +528,9 @@ function Packet(link, id, kind) { Packet.prototype.addTo = function (queue) { this.link = null; if (queue == null) return this; - var peek, next = queue; - while ((peek = next.link) != null) - next = peek; + var peek, + next = queue; + while ((peek = next.link) != null) next = peek; next.link = this; return queue; }; diff --git a/benchmarks/v8-v7/splay.js b/benchmarks/v8-v7/splay.js index 6b4f56d321..36888bbd10 100644 --- a/benchmarks/v8-v7/splay.js +++ b/benchmarks/v8-v7/splay.js @@ -33,11 +33,10 @@ // also has to deal with a lot of changes to the large tree object // graph. -var Splay = new BenchmarkSuite('Splay', 81491, [ - new Benchmark("Splay", SplayRun, SplaySetup, SplayTearDown) +var Splay = new BenchmarkSuite("Splay", 81491, [ + new Benchmark("Splay", SplayRun, SplaySetup, SplayTearDown), ]); - // Configuration. var kSplayTreeSize = 8000; var kSplayTreeModifications = 80; @@ -45,29 +44,26 @@ var kSplayTreePayloadDepth = 5; var splayTree = null; - function GeneratePayloadTree(depth, tag) { if (depth == 0) { return { - array : [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], - string : 'String for key ' + tag + ' in leaf node' + array: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], + string: "String for key " + tag + " in leaf node", }; } else { return { - left: GeneratePayloadTree(depth - 1, tag), - right: GeneratePayloadTree(depth - 1, tag) + left: GeneratePayloadTree(depth - 1, tag), + right: GeneratePayloadTree(depth - 1, tag), }; } } - function GenerateKey() { // The benchmark framework guarantees that Math.random is // deterministic; see base.js. return Math.random(); } - function InsertNewNode() { // Insert new node with a unique key. var key; @@ -79,14 +75,11 @@ function InsertNewNode() { return key; } - - function SplaySetup() { splayTree = new SplayTree(); for (var i = 0; i < kSplayTreeSize; i++) InsertNewNode(); } - function SplayTearDown() { // Allow the garbage collector to reclaim the memory // used by the splay tree no matter how we exit the @@ -108,7 +101,6 @@ function SplayTearDown() { } } - function SplayRun() { // Replace a few nodes in the splay tree. for (var i = 0; i < kSplayTreeModifications; i++) { @@ -119,7 +111,6 @@ function SplayRun() { } } - /** * Constructs a Splay tree. A splay tree is a self-balancing binary * search tree with the additional property that recently accessed @@ -128,9 +119,7 @@ function SplayRun() { * * @constructor */ -function SplayTree() { -}; - +function SplayTree() {} /** * Pointer to the root node of the tree. @@ -140,15 +129,13 @@ function SplayTree() { */ SplayTree.prototype.root_ = null; - /** * @return {boolean} Whether the tree is empty. */ -SplayTree.prototype.isEmpty = function() { +SplayTree.prototype.isEmpty = function () { return !this.root_; }; - /** * Inserts a node into the tree with the specified key and value if * the tree does not already contain a node with the specified key. If @@ -157,7 +144,7 @@ SplayTree.prototype.isEmpty = function() { * @param {number} key Key to insert into the tree. * @param {*} value Value to insert into the tree. */ -SplayTree.prototype.insert = function(key, value) { +SplayTree.prototype.insert = function (key, value) { if (this.isEmpty()) { this.root_ = new SplayTree.Node(key, value); return; @@ -181,7 +168,6 @@ SplayTree.prototype.insert = function(key, value) { this.root_ = node; }; - /** * Removes a node with the specified key from the tree if the tree * contains a node with this key. The removed node is returned. If the @@ -190,13 +176,13 @@ SplayTree.prototype.insert = function(key, value) { * @param {number} key Key to find and remove from the tree. * @return {SplayTree.Node} The removed node. */ -SplayTree.prototype.remove = function(key) { +SplayTree.prototype.remove = function (key) { if (this.isEmpty()) { - throw Error('Key not found: ' + key); + throw Error("Key not found: " + key); } this.splay_(key); if (this.root_.key != key) { - throw Error('Key not found: ' + key); + throw Error("Key not found: " + key); } var removed = this.root_; if (!this.root_.left) { @@ -213,7 +199,6 @@ SplayTree.prototype.remove = function(key) { return removed; }; - /** * Returns the node having the specified key or null if the tree doesn't contain * a node with the specified key. @@ -221,7 +206,7 @@ SplayTree.prototype.remove = function(key) { * @param {number} key Key to find in the tree. * @return {SplayTree.Node} Node having the specified key. */ -SplayTree.prototype.find = function(key) { +SplayTree.prototype.find = function (key) { if (this.isEmpty()) { return null; } @@ -229,11 +214,10 @@ SplayTree.prototype.find = function(key) { return this.root_.key == key ? this.root_ : null; }; - /** * @return {SplayTree.Node} Node having the maximum key value. */ -SplayTree.prototype.findMax = function(opt_startNode) { +SplayTree.prototype.findMax = function (opt_startNode) { if (this.isEmpty()) { return null; } @@ -244,12 +228,11 @@ SplayTree.prototype.findMax = function(opt_startNode) { return current; }; - /** * @return {SplayTree.Node} Node having the maximum key value that * is less than the specified key value. */ -SplayTree.prototype.findGreatestLessThan = function(key) { +SplayTree.prototype.findGreatestLessThan = function (key) { if (this.isEmpty()) { return null; } @@ -267,19 +250,19 @@ SplayTree.prototype.findGreatestLessThan = function(key) { } }; - /** * @return {Array<*>} An array containing all the keys of tree's nodes. */ -SplayTree.prototype.exportKeys = function() { +SplayTree.prototype.exportKeys = function () { var result = []; if (!this.isEmpty()) { - this.root_.traverse_(function(node) { result.push(node.key); }); + this.root_.traverse_(function (node) { + result.push(node.key); + }); } return result; }; - /** * Perform the splay operation for the given key. Moves the node with * the given key to the top of the tree. If no node has the given @@ -290,7 +273,7 @@ SplayTree.prototype.exportKeys = function() { * @param {number} key Key to splay the tree on. * @private */ -SplayTree.prototype.splay_ = function(key) { +SplayTree.prototype.splay_ = function (key) { if (this.isEmpty()) { return; } @@ -351,31 +334,27 @@ SplayTree.prototype.splay_ = function(key) { this.root_ = current; }; - /** * Constructs a Splay tree node. * * @param {number} key Key. * @param {*} value Value. */ -SplayTree.Node = function(key, value) { +SplayTree.Node = function (key, value) { this.key = key; this.value = value; }; - /** * @type {SplayTree.Node} */ SplayTree.Node.prototype.left = null; - /** * @type {SplayTree.Node} */ SplayTree.Node.prototype.right = null; - /** * Performs an ordered traversal of the subtree starting at * this SplayTree.Node. @@ -383,7 +362,7 @@ SplayTree.Node.prototype.right = null; * @param {function(SplayTree.Node)} f Visitor function. * @private */ -SplayTree.Node.prototype.traverse_ = function(f) { +SplayTree.Node.prototype.traverse_ = function (f) { var current = this; while (current) { var left = current.left; diff --git a/build.mjs b/build.mjs index 0ecb07c8fe..81ca539c5c 100644 --- a/build.mjs +++ b/build.mjs @@ -556,10 +556,13 @@ async function buildLibrary() { }); // Build tests - const testEntryPoints = {}; - TEST_FILES.forEach((entry) => { - testEntryPoints[path.join("__tests__", `${entry.slice(0, -3)}`)] = entry; - }); + const testEntryPoints = TEST_FILES.reduce((acc, entry) => { + const { name, dir } = path.parse(entry); + const parentDir = path.basename(dir); + acc[path.join("__tests__", parentDir, name)] = entry; + return acc; + }, {}); + await esbuild.build({ ...defaultLibEsBuildOption, entryPoints: testEntryPoints, diff --git a/example/functions/src/react/CreateTodo.tsx b/example/functions/src/react/CreateTodo.tsx index 0403f5182f..6325a9afd9 100644 --- a/example/functions/src/react/CreateTodo.tsx +++ b/example/functions/src/react/CreateTodo.tsx @@ -1,19 +1,24 @@ type Props = { - onCreate: (text:string) => void -} - -function CreateTodo({onCreate}:Props){ + onCreate: (text: string) => void; +}; - const handleKeyDown = (e:React.KeyboardEvent) => { - if (e.key === 'Enter') { - const target = (e.target as any); - onCreate(target.value) - target.value = "" - } +function CreateTodo({ onCreate }: Props) { + const handleKeyDown = (e: React.KeyboardEvent) => { + if (e.key === "Enter") { + const target = e.target as any; + onCreate(target.value); + target.value = ""; } + }; - - return + return ( + + ); } -export default CreateTodo \ No newline at end of file +export default CreateTodo; diff --git a/example/functions/src/react/index.html b/example/functions/src/react/index.html index f8e87cd54b..ce42fc65c3 100644 --- a/example/functions/src/react/index.html +++ b/example/functions/src/react/index.html @@ -1,4 +1,4 @@ - + diff --git a/example/functions/src/v2.js b/example/functions/src/v2.js index 868cbb8c85..c6879a4364 100644 --- a/example/functions/src/v2.js +++ b/example/functions/src/v2.js @@ -3,21 +3,21 @@ const DynamoDB = require("aws-sdk/clients/dynamodb.js"); const client = new DynamoDB(); export const handler = async (event) => { - await client - .putItem({ - TableName: process.env.TABLE_NAME, - Item: { - id: { - S: Math.random().toString(36).substring(2), - }, - content: { - S: JSON.stringify(event), - }, - }, - }) - .promise(); - return { - statusCode: 200, - body: "OK", - }; + await client + .putItem({ + TableName: process.env.TABLE_NAME, + Item: { + id: { + S: Math.random().toString(36).substring(2), + }, + content: { + S: JSON.stringify(event), + }, + }, + }) + .promise(); + return { + statusCode: 200, + body: "OK", + }; }; diff --git a/example/functions/src/v3-lib.mjs b/example/functions/src/v3-lib.mjs index 8cd6721ab0..fe44d7f922 100644 --- a/example/functions/src/v3-lib.mjs +++ b/example/functions/src/v3-lib.mjs @@ -5,17 +5,17 @@ const client = new DynamoDBClient({}); const docClient = DynamoDBDocumentClient.from(client); export const handler = async (event) => { - await docClient.send( - new PutCommand({ - TableName: process.env.TABLE_NAME, - Item: { - id: Math.random().toString(36).substring(2), - content: JSON.stringify(event), - }, - }) - ); - return { - statusCode: 200, - body: "OK", - }; + await docClient.send( + new PutCommand({ + TableName: process.env.TABLE_NAME, + Item: { + id: Math.random().toString(36).substring(2), + content: JSON.stringify(event), + }, + }) + ); + return { + statusCode: 200, + body: "OK", + }; }; diff --git a/example/functions/src/v3-mono.mjs b/example/functions/src/v3-mono.mjs index 504e785335..aae0ad8333 100644 --- a/example/functions/src/v3-mono.mjs +++ b/example/functions/src/v3-mono.mjs @@ -3,19 +3,19 @@ import { DynamoDB } from "@aws-sdk/client-dynamodb"; const client = new DynamoDB({}); export const handler = async (event) => { - await client.putItem({ - TableName: process.env.TABLE_NAME, - Item: { - id: { - S: Math.random().toString(36).substring(2), - }, - content: { - S: JSON.stringify(event), - }, - }, - }); - return { - statusCode: 200, - body: "OK", - }; + await client.putItem({ + TableName: process.env.TABLE_NAME, + Item: { + id: { + S: Math.random().toString(36).substring(2), + }, + content: { + S: JSON.stringify(event), + }, + }, + }); + return { + statusCode: 200, + body: "OK", + }; }; diff --git a/example/functions/src/v3.mjs b/example/functions/src/v3.mjs index 2561af4c3f..2de0c2a081 100644 --- a/example/functions/src/v3.mjs +++ b/example/functions/src/v3.mjs @@ -3,21 +3,21 @@ import { DynamoDBClient, PutItemCommand } from "@aws-sdk/client-dynamodb"; const client = new DynamoDBClient({}); export const handler = async (event) => { - await client.send( - new PutItemCommand({ - TableName: process.env.TABLE_NAME, - Item: { - id: { - S: Math.random().toString(36).substring(2), - }, - content: { - S: JSON.stringify(event), - }, - }, - }) - ); - return { - statusCode: 200, - body: "OK", - }; + await client.send( + new PutItemCommand({ + TableName: process.env.TABLE_NAME, + Item: { + id: { + S: Math.random().toString(36).substring(2), + }, + content: { + S: JSON.stringify(event), + }, + }, + }) + ); + return { + statusCode: 200, + body: "OK", + }; }; diff --git a/example/llrt-sam-container-image/README.md b/example/llrt-sam-container-image/README.md index facee5e328..ee90a8dd5c 100644 --- a/example/llrt-sam-container-image/README.md +++ b/example/llrt-sam-container-image/README.md @@ -15,8 +15,8 @@ The Serverless Application Model Command Line Interface (SAM CLI) is an extensio To use the SAM CLI, you need the following tools. -* Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community) -* SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) +- Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community) +- SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) To build and deploy your application for the first time, run the following in your shell: @@ -27,11 +27,11 @@ sam deploy --guided The first command will build a docker image from a Dockerfile and then the source of your application inside the Docker image. The second command will package and deploy your application to AWS, with a series of prompts: -* **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name. -* **AWS Region**: The AWS region you want to deploy your app to. -* **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes. -* **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modifies IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command. -* **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application. +- **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name. +- **AWS Region**: The AWS region you want to deploy your app to. +- **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes. +- **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modifies IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command. +- **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application. You can find your API Gateway Endpoint URL in the output values displayed after deployment. @@ -44,7 +44,8 @@ llrt-sam-oci$ sam build ``` The SAM CLI builds a docker image from a Dockerfile and then installs dependencies defined in `hello-world/package.json` inside the docker image. The processed template file is saved in the `.aws-sam/build` folder. -* **Note**: The Dockerfile included in this sample application uses `npm install` by default. If you are building your code for production, you can modify it to use `npm ci` instead. + +- **Note**: The Dockerfile included in this sample application uses `npm install` by default. If you are building your code for production, you can modify it to use `npm ci` instead. Test a single function by invoking it directly with a test event. An event is a JSON document that represents the input that the function receives from the event source. Test events are included in the `events` folder in this project. @@ -64,15 +65,16 @@ llrt-sam-oci$ curl http://localhost:3000/ The SAM CLI reads the application template to determine the API's routes and the functions that they invoke. The `Events` property on each function's definition includes the route and method for each path. ```yaml - Events: - HelloWorld: - Type: Api - Properties: - Path: /hello - Method: get +Events: + HelloWorld: + Type: Api + Properties: + Path: /hello + Method: get ``` ## Add a resource to your application + The application template uses AWS Serverless Application Model (AWS SAM) to define application resources. AWS SAM is an extension of AWS CloudFormation with a simpler syntax for configuring common serverless application resources such as functions, triggers, and APIs. For resources not included in [the SAM specification](https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md), you can use standard [AWS CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) resource types. ## Fetch, tail, and filter Lambda function logs diff --git a/example/llrt-sam/README.md b/example/llrt-sam/README.md index c82ab84312..b1f18f5dc6 100644 --- a/example/llrt-sam/README.md +++ b/example/llrt-sam/README.md @@ -10,17 +10,17 @@ The application uses several AWS resources, including Lambda functions and an AW If you prefer to use an integrated development environment (IDE) to build and test your application, you can use the AWS Toolkit. The AWS Toolkit is an open source plug-in for popular IDEs that uses the SAM CLI to build and deploy serverless applications on AWS. The AWS Toolkit also adds a simplified step-through debugging experience for Lambda function code. See the following links to get started. -* [CLion](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) -* [GoLand](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) -* [IntelliJ](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) -* [WebStorm](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) -* [Rider](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) -* [PhpStorm](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) -* [PyCharm](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) -* [RubyMine](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) -* [DataGrip](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) -* [VS Code](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/welcome.html) -* [Visual Studio](https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/welcome.html) +- [CLion](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) +- [GoLand](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) +- [IntelliJ](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) +- [WebStorm](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) +- [Rider](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) +- [PhpStorm](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) +- [PyCharm](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) +- [RubyMine](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) +- [DataGrip](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html) +- [VS Code](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/welcome.html) +- [Visual Studio](https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/welcome.html) ## Deploy the sample application @@ -28,9 +28,9 @@ The Serverless Application Model Command Line Interface (SAM CLI) is an extensio To use the SAM CLI, you need the following tools. -* SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) -* Node.js - [Install Node.js 18](https://nodejs.org/en/), including the NPM package management tool. -* Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community) +- SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) +- Node.js - [Install Node.js 18](https://nodejs.org/en/), including the NPM package management tool. +- Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community) To build and deploy your application for the first time, run the following in your shell: @@ -41,11 +41,11 @@ sam deploy --guided The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts: -* **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name. -* **AWS Region**: The AWS region you want to deploy your app to. -* **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes. -* **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modifies IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command. -* **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application. +- **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name. +- **AWS Region**: The AWS region you want to deploy your app to. +- **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes. +- **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modifies IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command. +- **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application. You can find your API Gateway Endpoint URL in the output values displayed after deployment. @@ -68,6 +68,7 @@ llrt-sam$ sam local invoke HelloWorldFunction ``` ## Add a resource to your application + The application template uses AWS Serverless Application Model (AWS SAM) to define application resources. AWS SAM is an extension of AWS CloudFormation with a simpler syntax for configuring common serverless application resources such as functions, triggers, and APIs. For resources not included in [the SAM specification](https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md), you can use standard [AWS CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) resource types. ## Fetch, tail, and filter Lambda function logs diff --git a/example/llrt-sam/hello-world/app.ts b/example/llrt-sam/hello-world/app.ts index 09939f7471..d8f5b2f59b 100644 --- a/example/llrt-sam/hello-world/app.ts +++ b/example/llrt-sam/hello-world/app.ts @@ -1,4 +1,4 @@ -import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda'; +import { APIGatewayProxyEvent, APIGatewayProxyResult } from "aws-lambda"; /** * @@ -10,21 +10,23 @@ import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda'; * */ -export const lambdaHandler = async (event: APIGatewayProxyEvent): Promise => { - try { - return { - statusCode: 200, - body: JSON.stringify({ - message: 'hello world', - }), - }; - } catch (err) { - console.log(err); - return { - statusCode: 500, - body: JSON.stringify({ - message: 'some error happened', - }), - }; - } +export const lambdaHandler = async ( + event: APIGatewayProxyEvent +): Promise => { + try { + return { + statusCode: 200, + body: JSON.stringify({ + message: "hello world", + }), + }; + } catch (err) { + console.log(err); + return { + statusCode: 500, + body: JSON.stringify({ + message: "some error happened", + }), + }; + } }; diff --git a/example/llrt-sam/hello-world/tsconfig.json b/example/llrt-sam/hello-world/tsconfig.json index ffaf193ea8..b150bda73d 100644 --- a/example/llrt-sam/hello-world/tsconfig.json +++ b/example/llrt-sam/hello-world/tsconfig.json @@ -1,15 +1,15 @@ { - "compilerOptions": { - "target": "es2020", - "strict": true, - "preserveConstEnums": true, - "noEmit": true, - "sourceMap": false, - "module":"es2015", - "moduleResolution":"node", - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - }, - "exclude": ["node_modules", "**/*.test.ts"] - } \ No newline at end of file + "compilerOptions": { + "target": "es2020", + "strict": true, + "preserveConstEnums": true, + "noEmit": true, + "sourceMap": false, + "module": "es2015", + "moduleResolution": "node", + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "exclude": ["node_modules", "**/*.test.ts"] +} diff --git a/example/llrt-sam/template.yaml b/example/llrt-sam/template.yaml index b328246e9a..c0e9074fd0 100644 --- a/example/llrt-sam/template.yaml +++ b/example/llrt-sam/template.yaml @@ -1,4 +1,4 @@ -AWSTemplateFormatVersion: '2010-09-09' +AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 Description: > llrt-sam @@ -11,7 +11,6 @@ Globals: Timeout: 3 Resources: - LlrtLayer: Type: AWS::Serverless::LayerVersion Properties: @@ -34,8 +33,8 @@ Resources: BuildMethod: esbuild BuildProperties: External: - - '@aws-sdk' - - '@smithy' + - "@aws-sdk" + - "@smithy" - uuid Minify: false Target: "es2020" @@ -44,7 +43,7 @@ Resources: OutExtension: - .js=.mjs EntryPoints: - - app.ts + - app.ts Outputs: HelloWorldFunction: diff --git a/fixtures/fs/readdir/readdir.js b/fixtures/fs/readdir/readdir.js index c4fa72fac3..2ca44b32f1 100644 --- a/fixtures/fs/readdir/readdir.js +++ b/fixtures/fs/readdir/readdir.js @@ -1,3 +1,3 @@ -import fs from 'fs/promises'; +import fs from "fs/promises"; -fs.readdir('./', { recursive: true }).then(res => {}); +fs.readdir("./", { recursive: true }).then((res) => {}); diff --git a/fixtures/fs/readdir/recursive/readdir.js b/fixtures/fs/readdir/recursive/readdir.js index c4fa72fac3..2ca44b32f1 100644 --- a/fixtures/fs/readdir/recursive/readdir.js +++ b/fixtures/fs/readdir/recursive/readdir.js @@ -1,3 +1,3 @@ -import fs from 'fs/promises'; +import fs from "fs/promises"; -fs.readdir('./', { recursive: true }).then(res => {}); +fs.readdir("./", { recursive: true }).then((res) => {}); diff --git a/fixtures/throw.js b/fixtures/throw.js index ba052821c3..55ac57b8df 100644 --- a/fixtures/throw.js +++ b/fixtures/throw.js @@ -1 +1 @@ -throw 42 +throw 42; diff --git a/package.json b/package.json index c41fc8ff0b..3c0a37e3f5 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,10 @@ "version": "1.0.0", "type": "module", "private": true, + "prettier": { + "trailingComma": "es5", + "singleQuote": false + }, "scripts": { "esbuild": "esbuild", "update": "yarn upgrade-interactive --latest", diff --git a/shims/lru-cache.js b/shims/lru-cache.js index e452abfa00..07e6bf5e26 100644 --- a/shims/lru-cache.js +++ b/shims/lru-cache.js @@ -1,39 +1,39 @@ class LRUCache { - constructor(capacity = 10) { - this.capacity = capacity; - this.cache = new Map(); - } + constructor(capacity = 10) { + this.capacity = capacity; + this.cache = new Map(); + } - get(key) { - let item = this.cache.get(key); - if (item) { - // refresh key - this.cache.delete(key); - this.cache.set(key, item); - } - return item; + get(key) { + let item = this.cache.get(key); + if (item) { + // refresh key + this.cache.delete(key); + this.cache.set(key, item); } + return item; + } - set(key, val) { - if (this.cache.has(key)) { - this.cache.delete(key); - } else if (this.cache.size == this.capacity) { - this.cache.delete(this.first()); - } - this.cache.set(key, val); + set(key, val) { + if (this.cache.has(key)) { + this.cache.delete(key); + } else if (this.cache.size == this.capacity) { + this.cache.delete(this.first()); } + this.cache.set(key, val); + } - has(key) { - return this.cache.has(key); - } + has(key) { + return this.cache.has(key); + } - first() { - return this.cache.keys().next().value; - } + first() { + return this.cache.keys().next().value; + } - clear() { - this.cache.clear(); - } + clear() { + this.cache.clear(); + } } export default LRUCache; diff --git a/shims/util-utf8.js b/shims/util-utf8.js index e6d0f262af..831a3eff1d 100644 --- a/shims/util-utf8.js +++ b/shims/util-utf8.js @@ -5,15 +5,15 @@ export const fromUtf8 = (input) => ENCODER.encode(input); export const toUtf8 = (input) => DECODER.decode(input); export const toUint8Array = (data) => { - if (typeof data === "string") { - return fromUtf8(data); - } - if (ArrayBuffer.isView(data)) { - return new Uint8Array( - data.buffer, - data.byteOffset, - data.byteLength / Uint8Array.BYTES_PER_ELEMENT - ); - } - return new Uint8Array(data); + if (typeof data === "string") { + return fromUtf8(data); + } + if (ArrayBuffer.isView(data)) { + return new Uint8Array( + data.buffer, + data.byteOffset, + data.byteLength / Uint8Array.BYTES_PER_ELEMENT + ); + } + return new Uint8Array(data); }; diff --git a/src/js/@llrt/expect/jest-asymmetric-matchers.ts b/src/js/@llrt/expect/jest-asymmetric-matchers.ts index 808c8bf0a7..a1cdc8fb28 100644 --- a/src/js/@llrt/expect/jest-asymmetric-matchers.ts +++ b/src/js/@llrt/expect/jest-asymmetric-matchers.ts @@ -27,21 +27,26 @@ SOFTWARE. import ChaiPlugin = Chai.ChaiPlugin; -import { equals, isA, pluralize } from './jest-utils' -import {stringify} from "./stringify"; +import { equals, isA, pluralize } from "./jest-utils"; +import { stringify } from "./stringify"; export interface AsymmetricMatcherInterface { - asymmetricMatch: (other: unknown) => boolean - toString: () => string - getExpectedType?: () => string - toAsymmetricMatcher?: () => string + asymmetricMatch: (other: unknown) => boolean; + toString: () => string; + getExpectedType?: () => string; + toAsymmetricMatcher?: () => string; } -export abstract class AsymmetricMatcher implements AsymmetricMatcherInterface { +export abstract class AsymmetricMatcher + implements AsymmetricMatcherInterface +{ // should have "jest" to be compatible with its ecosystem - $$typeof = Symbol.for('jest.asymmetricMatcher') + $$typeof = Symbol.for("jest.asymmetricMatcher"); - constructor(protected sample: T, protected inverse = false) {} + constructor( + protected sample: T, + protected inverse = false + ) {} // protected getMatcherContext(expect?: Chai.ExpectStatic): State { // return { @@ -58,348 +63,332 @@ export abstract class AsymmetricMatcher implements AsymmetricMatcherInterface // } // } - abstract asymmetricMatch(other: unknown): boolean - abstract toString(): string - getExpectedType?(): string - toAsymmetricMatcher?(): string + abstract asymmetricMatch(other: unknown): boolean; + abstract toString(): string; + getExpectedType?(): string; + toAsymmetricMatcher?(): string; // implement custom chai/loupe inspect for better AssertionError.message formatting // https://github.com/chaijs/loupe/blob/9b8a6deabcd50adc056a64fb705896194710c5c6/src/index.ts#L29 - [Symbol.for('chai/inspect')](options: { depth: number; truncate: number }) { + [Symbol.for("chai/inspect")](options: { depth: number; truncate: number }) { // minimal pretty-format with simple manual truncation - const result = stringify(this, options.depth, { min: true }) - if (result.length <= options.truncate) - return result - return `${this.toString()}{…}` + const result = stringify(this, options.depth, { min: true }); + if (result.length <= options.truncate) return result; + return `${this.toString()}{…}`; } } export class StringContaining extends AsymmetricMatcher { constructor(sample: string, inverse = false) { - if (!isA('String', sample)) - throw new Error('Expected is not a string') + if (!isA("String", sample)) throw new Error("Expected is not a string"); - super(sample, inverse) + super(sample, inverse); } asymmetricMatch(other: string) { - const result = isA('String', other) && other.includes(this.sample) + const result = isA("String", other) && other.includes(this.sample); - return this.inverse ? !result : result + return this.inverse ? !result : result; } toString() { - return `String${this.inverse ? 'Not' : ''}Containing` + return `String${this.inverse ? "Not" : ""}Containing`; } getExpectedType() { - return 'string' + return "string"; } } export class Anything extends AsymmetricMatcher { asymmetricMatch(other: unknown) { - return other != null + return other != null; } toString() { - return 'Anything' + return "Anything"; } toAsymmetricMatcher() { - return 'Anything' + return "Anything"; } } -export class ObjectContaining extends AsymmetricMatcher> { +export class ObjectContaining extends AsymmetricMatcher< + Record +> { constructor(sample: Record, inverse = false) { - super(sample, inverse) + super(sample, inverse); } getPrototype(obj: object) { - if (Object.getPrototypeOf) - return Object.getPrototypeOf(obj) + if (Object.getPrototypeOf) return Object.getPrototypeOf(obj); - if (obj.constructor.prototype === obj) - return null + if (obj.constructor.prototype === obj) return null; - return obj.constructor.prototype + return obj.constructor.prototype; } hasProperty(obj: object | null, property: string): boolean { - if (!obj) - return false + if (!obj) return false; - if (Object.prototype.hasOwnProperty.call(obj, property)) - return true + if (Object.prototype.hasOwnProperty.call(obj, property)) return true; - return this.hasProperty(this.getPrototype(obj), property) + return this.hasProperty(this.getPrototype(obj), property); } asymmetricMatch(other: any) { - if (typeof this.sample !== 'object') { + if (typeof this.sample !== "object") { throw new TypeError( - `You must provide an object to ${this.toString()}, not '${ - typeof this.sample - }'.`, - ) + `You must provide an object to ${this.toString()}, not '${typeof this + .sample}'.` + ); } - let result = true + let result = true; // const matcherContext = this.getMatcherContext() for (const property in this.sample) { - if (!this.hasProperty(other, property) || !equals(this.sample[property], other[property], [])) { - result = false - break + if ( + !this.hasProperty(other, property) || + !equals(this.sample[property], other[property], []) + ) { + result = false; + break; } } - return this.inverse ? !result : result + return this.inverse ? !result : result; } toString() { - return `Object${this.inverse ? 'Not' : ''}Containing` + return `Object${this.inverse ? "Not" : ""}Containing`; } getExpectedType() { - return 'object' + return "object"; } } export class ArrayContaining extends AsymmetricMatcher> { constructor(sample: Array, inverse = false) { - super(sample, inverse) + super(sample, inverse); } asymmetricMatch(other: Array) { if (!Array.isArray(this.sample)) { throw new TypeError( - `You must provide an array to ${this.toString()}, not '${ - typeof this.sample - }'.`, - ) + `You must provide an array to ${this.toString()}, not '${typeof this + .sample}'.` + ); } - const result - = this.sample.length === 0 - || (Array.isArray(other) - && this.sample.every(item => - other.some(another => equals(item, another, [])), - )) + const result = + this.sample.length === 0 || + (Array.isArray(other) && + this.sample.every((item) => + other.some((another) => equals(item, another, [])) + )); - return this.inverse ? !result : result + return this.inverse ? !result : result; } toString() { - return `Array${this.inverse ? 'Not' : ''}Containing` + return `Array${this.inverse ? "Not" : ""}Containing`; } getExpectedType() { - return 'array' + return "array"; } } export class Any extends AsymmetricMatcher { constructor(sample: unknown) { - if (typeof sample === 'undefined') { + if (typeof sample === "undefined") { throw new TypeError( - 'any() expects to be passed a constructor function. ' - + 'Please pass one or use anything() to match any object.', - ) + "any() expects to be passed a constructor function. " + + "Please pass one or use anything() to match any object." + ); } - super(sample) + super(sample); } fnNameFor(func: Function) { - if (func.name) - return func.name + if (func.name) return func.name; - const functionToString = Function.prototype.toString + const functionToString = Function.prototype.toString; const matches = functionToString .call(func) - .match(/^(?:async)?\s*function\s*\*?\s*([\w$]+)\s*\(/) - return matches ? matches[1] : '' + .match(/^(?:async)?\s*function\s*\*?\s*([\w$]+)\s*\(/); + return matches ? matches[1] : ""; } asymmetricMatch(other: unknown) { if (this.sample === String) - return typeof other == 'string' || other instanceof String + return typeof other == "string" || other instanceof String; if (this.sample === Number) - return typeof other == 'number' || other instanceof Number + return typeof other == "number" || other instanceof Number; if (this.sample === Function) - return typeof other == 'function' || other instanceof Function + return typeof other == "function" || other instanceof Function; if (this.sample === Boolean) - return typeof other == 'boolean' || other instanceof Boolean + return typeof other == "boolean" || other instanceof Boolean; if (this.sample === BigInt) - return typeof other == 'bigint' || other instanceof BigInt + return typeof other == "bigint" || other instanceof BigInt; if (this.sample === Symbol) - return typeof other == 'symbol' || other instanceof Symbol + return typeof other == "symbol" || other instanceof Symbol; - if (this.sample === Object) - return typeof other == 'object' + if (this.sample === Object) return typeof other == "object"; - return other instanceof this.sample + return other instanceof this.sample; } toString() { - return 'Any' + return "Any"; } getExpectedType() { - if (this.sample === String) - return 'string' + if (this.sample === String) return "string"; - if (this.sample === Number) - return 'number' + if (this.sample === Number) return "number"; - if (this.sample === Function) - return 'function' + if (this.sample === Function) return "function"; - if (this.sample === Object) - return 'object' + if (this.sample === Object) return "object"; - if (this.sample === Boolean) - return 'boolean' + if (this.sample === Boolean) return "boolean"; - return this.fnNameFor(this.sample) + return this.fnNameFor(this.sample); } toAsymmetricMatcher() { - return `Any<${this.fnNameFor(this.sample)}>` + return `Any<${this.fnNameFor(this.sample)}>`; } } export class StringMatching extends AsymmetricMatcher { constructor(sample: string | RegExp, inverse = false) { - if (!isA('String', sample) && !isA('RegExp', sample)) - throw new Error('Expected is not a String or a RegExp') + if (!isA("String", sample) && !isA("RegExp", sample)) + throw new Error("Expected is not a String or a RegExp"); - super(new RegExp(sample), inverse) + super(new RegExp(sample), inverse); } asymmetricMatch(other: string) { - const result = isA('String', other) && this.sample.test(other) + const result = isA("String", other) && this.sample.test(other); - return this.inverse ? !result : result + return this.inverse ? !result : result; } toString() { - return `String${this.inverse ? 'Not' : ''}Matching` + return `String${this.inverse ? "Not" : ""}Matching`; } getExpectedType() { - return 'string' + return "string"; } } class CloseTo extends AsymmetricMatcher { - private readonly precision: number + private readonly precision: number; constructor(sample: number, precision = 2, inverse = false) { - if (!isA('Number', sample)) - throw new Error('Expected is not a Number') + if (!isA("Number", sample)) throw new Error("Expected is not a Number"); - if (!isA('Number', precision)) - throw new Error('Precision is not a Number') + if (!isA("Number", precision)) throw new Error("Precision is not a Number"); - super(sample) - this.inverse = inverse - this.precision = precision + super(sample); + this.inverse = inverse; + this.precision = precision; } asymmetricMatch(other: number) { - if (!isA('Number', other)) - return false - - let result = false - if (other === Number.POSITIVE_INFINITY && this.sample === Number.POSITIVE_INFINITY) { - result = true // Infinity - Infinity is NaN - } - else if (other === Number.NEGATIVE_INFINITY && this.sample === Number.NEGATIVE_INFINITY) { - result = true // -Infinity - -Infinity is NaN + if (!isA("Number", other)) return false; + + let result = false; + if ( + other === Number.POSITIVE_INFINITY && + this.sample === Number.POSITIVE_INFINITY + ) { + result = true; // Infinity - Infinity is NaN + } else if ( + other === Number.NEGATIVE_INFINITY && + this.sample === Number.NEGATIVE_INFINITY + ) { + result = true; // -Infinity - -Infinity is NaN + } else { + result = Math.abs(this.sample - other) < 10 ** -this.precision / 2; } - else { - result - = Math.abs(this.sample - other) < 10 ** -this.precision / 2 - } - return this.inverse ? !result : result + return this.inverse ? !result : result; } toString() { - return `Number${this.inverse ? 'Not' : ''}CloseTo` + return `Number${this.inverse ? "Not" : ""}CloseTo`; } override getExpectedType() { - return 'number' + return "number"; } override toAsymmetricMatcher(): string { return [ this.toString(), this.sample, - `(${pluralize('digit', this.precision)})`, - ].join(' ') + `(${pluralize("digit", this.precision)})`, + ].join(" "); } } export const JestAsymmetricMatchers: ChaiPlugin = (chai, utils) => { - utils.addMethod( - chai.expect, - 'anything', - () => new Anything(), - ) + utils.addMethod(chai.expect, "anything", () => new Anything()); - utils.addMethod( - chai.expect, - 'any', - (expected: unknown) => new Any(expected), - ) + utils.addMethod(chai.expect, "any", (expected: unknown) => new Any(expected)); utils.addMethod( chai.expect, - 'stringContaining', - (expected: string) => new StringContaining(expected), - ) + "stringContaining", + (expected: string) => new StringContaining(expected) + ); utils.addMethod( chai.expect, - 'objectContaining', - (expected: any) => new ObjectContaining(expected), - ) + "objectContaining", + (expected: any) => new ObjectContaining(expected) + ); utils.addMethod( chai.expect, - 'arrayContaining', - (expected: Array) => new ArrayContaining(expected), - ) + "arrayContaining", + (expected: Array) => new ArrayContaining(expected) + ); utils.addMethod( chai.expect, - 'stringMatching', - (expected: any) => new StringMatching(expected), - ) + "stringMatching", + (expected: any) => new StringMatching(expected) + ); utils.addMethod( chai.expect, - 'closeTo', - (expected: any, precision?: number) => new CloseTo(expected, precision), - ) + "closeTo", + (expected: any, precision?: number) => new CloseTo(expected, precision) + ); // defineProperty does not work - ;(chai.expect as any).not = { - stringContaining: (expected: string) => new StringContaining(expected, true), + (chai.expect as any).not = { + stringContaining: (expected: string) => + new StringContaining(expected, true), objectContaining: (expected: any) => new ObjectContaining(expected, true), - arrayContaining: (expected: Array) => new ArrayContaining(expected, true), - stringMatching: (expected: string | RegExp) => new StringMatching(expected, true), - closeTo: (expected: any, precision?: number) => new CloseTo(expected, precision, true), - } -} - - + arrayContaining: (expected: Array) => + new ArrayContaining(expected, true), + stringMatching: (expected: string | RegExp) => + new StringMatching(expected, true), + closeTo: (expected: any, precision?: number) => + new CloseTo(expected, precision, true), + }; +}; diff --git a/src/js/@llrt/expect/jest-expect.ts b/src/js/@llrt/expect/jest-expect.ts index 8f9f7b9891..c2238783e6 100644 --- a/src/js/@llrt/expect/jest-expect.ts +++ b/src/js/@llrt/expect/jest-expect.ts @@ -26,550 +26,632 @@ SOFTWARE. // Extracted and modified from Vitest: https://github.com/vitest-dev/vitest/blob/a199ac2dd1322d7839d4d1350c983070da546805/packages/expect/src/jest-expect.ts import { - arrayBufferEquality, equals as jestEquals, generateToBeMessage, - iterableEquality, - sparseArrayEquality, subsetEquality, - typeEquality + arrayBufferEquality, + equals as jestEquals, + generateToBeMessage, + iterableEquality, + sparseArrayEquality, + subsetEquality, + typeEquality, } from "./jest-utils"; import ChaiPlugin = Chai.ChaiPlugin; import Assertion = Chai.Assertion; -import {AsymmetricMatcher} from "./jest-asymmetric-matchers"; +import { AsymmetricMatcher } from "./jest-asymmetric-matchers"; // Jest Expect Compact export const JestChaiExpect: ChaiPlugin = (chai, utils) => { - const {AssertionError} = chai - // const c = () => getColors() - const customTesters: ((a: any, b: any, customTesters?: Array, aStack?: Array, bStack?: Array) => (boolean | undefined))[] = [] - - function def(name: string | (string)[], fn: ((this: Chai.AssertionStatic & Assertion, ...args: any[]) => any)) { - const addMethod = (n: string) => { - // const softWrapper = wrapSoft(utils, fn) - utils.addMethod(chai.Assertion.prototype, n, fn) - // utils.addMethod((globalThis as any)[JEST_MATCHERS_OBJECT].matchers, n, softWrapper) + const { AssertionError } = chai; + // const c = () => getColors() + const customTesters: (( + a: any, + b: any, + customTesters?: Array, + aStack?: Array, + bStack?: Array + ) => boolean | undefined)[] = []; + + function def( + name: string | string[], + fn: (this: Chai.AssertionStatic & Assertion, ...args: any[]) => any + ) { + const addMethod = (n: string) => { + // const softWrapper = wrapSoft(utils, fn) + utils.addMethod(chai.Assertion.prototype, n, fn); + // utils.addMethod((globalThis as any)[JEST_MATCHERS_OBJECT].matchers, n, softWrapper) + }; + + if (Array.isArray(name)) name.forEach((n) => addMethod(n)); + else addMethod(name); + } + + (["throw", "throws", "Throw"] as const).forEach((m) => { + utils.overwriteMethod(chai.Assertion.prototype, m, (_super: any) => { + return function ( + this: Chai.Assertion & Chai.AssertionStatic, + ...args: any[] + ) { + const promise = utils.flag(this, "promise"); + const object = utils.flag(this, "object"); + const isNot = utils.flag(this, "negate") as boolean; + if (promise === "rejects") { + utils.flag(this, "object", () => { + throw object; + }); } - - if (Array.isArray(name)) - name.forEach(n => addMethod(n)) - - else - addMethod(name) - } - - (['throw', 'throws', 'Throw'] as const).forEach((m) => { - utils.overwriteMethod(chai.Assertion.prototype, m, (_super: any) => { - return function (this: Chai.Assertion & Chai.AssertionStatic, ...args: any[]) { - const promise = utils.flag(this, 'promise') - const object = utils.flag(this, 'object') - const isNot = utils.flag(this, 'negate') as boolean - if (promise === 'rejects') { - utils.flag(this, 'object', () => { - throw object - }) - } - // if it got here, it's already resolved - // unless it tries to resolve to a function that should throw - // called as '.resolves[.not].toThrow()` - else if (promise === 'resolves' && typeof object !== 'function') { - if (!isNot) { - const message = utils.flag(this, 'message') || 'expected promise to throw an error, but it didn\'t' - const error = { - showDiff: false, - } - throw new AssertionError(message, error, utils.flag(this, 'ssfi')) - } else { - return - } - } - _super.apply(this, args) - } - }) - }) - - def('toEqual', function (expected) { - const actual = utils.flag(this, 'object') - const equal = jestEquals( - actual, - expected, - [...customTesters, iterableEquality], - ) - return this.assert( - equal, - 'expected #{this} to deeply equal #{exp}', - 'expected #{this} to not deeply equal #{exp}', - expected, - actual, - ) - }) - - def('toStrictEqual', function (expected) { - const obj = utils.flag(this, 'object') - const equal = jestEquals( - obj, - expected, - [ - ...customTesters, - iterableEquality, - typeEquality, - sparseArrayEquality, - arrayBufferEquality, - ], - true, - ) - - return this.assert( - equal, - 'expected #{this} to strictly equal #{exp}', - 'expected #{this} to not strictly equal #{exp}', - expected, - obj, - ) - }) - def('toBe', function (expected) { - const actual = this._obj - const pass = Object.is(actual, expected) - - let deepEqualityName = '' - - if (!pass) { - const toStrictEqualPass = jestEquals( - actual, - expected, - [ - ...customTesters, - iterableEquality, - typeEquality, - sparseArrayEquality, - arrayBufferEquality, - ], - true, - ) - - if (toStrictEqualPass) { - deepEqualityName = 'toStrictEqual' - } else { - const toEqualPass = jestEquals( - actual, - expected, - [...customTesters, iterableEquality], - ) - - if (toEqualPass) - deepEqualityName = 'toEqual' - } - } - - return this.assert( - pass, - generateToBeMessage(deepEqualityName), - 'expected #{this} not to be #{exp} // Object.is equality', - expected, - actual, - ) - }) - def('toMatchObject', function (expected) { - const actual = this._obj - return this.assert( - jestEquals(actual, expected, [...customTesters, iterableEquality, subsetEquality]), - 'expected #{this} to match object #{exp}', - 'expected #{this} to not match object #{exp}', - expected, - actual, - ) - }) - def('toMatch', function (expected: string | RegExp) { - if (typeof expected === 'string') - return this.include(expected) - else - return this.match(expected) - }) - def('toContain', function (item) { - const actual = this._obj as Iterable | string - - // make "actual" indexable to have compatibility with jest - if (actual != null && typeof actual !== 'string') - utils.flag(this, 'object', Array.from(actual as Iterable)) - return this.contain(item) - }) - def('toContainEqual', function (expected) { - const obj = utils.flag(this, 'object') - const index = Array.from(obj).findIndex((item) => { - return jestEquals(item, expected, customTesters) - }) - - this.assert( - index !== -1, - 'expected #{this} to deep equally contain #{exp}', - 'expected #{this} to not deep equally contain #{exp}', - expected, - ) - }) - def('toBeTruthy', function () { - const obj = utils.flag(this, 'object') - this.assert( - Boolean(obj), - 'expected #{this} to be truthy', - 'expected #{this} to not be truthy', - obj, - false, - ) - }) - def('toBeFalsy', function () { - const obj = utils.flag(this, 'object') - this.assert( - !obj, - 'expected #{this} to be falsy', - 'expected #{this} to not be falsy', - obj, - false, - ) - }) - def('toBeGreaterThan', function (expected: number | bigint) { - const actual = this._obj as number | bigint - assertTypes(actual, 'actual', ['number', 'bigint']) - assertTypes(expected, 'expected', ['number', 'bigint']) - return this.assert( - actual > expected, - `expected ${actual} to be greater than ${expected}`, - `expected ${actual} to be not greater than ${expected}`, - actual, - expected, - false, - ) - }) - def('toBeGreaterThanOrEqual', function (expected: number | bigint) { - const actual = this._obj as number | bigint - assertTypes(actual, 'actual', ['number', 'bigint']) - assertTypes(expected, 'expected', ['number', 'bigint']) - return this.assert( - actual >= expected, - `expected ${actual} to be greater than or equal to ${expected}`, - `expected ${actual} to be not greater than or equal to ${expected}`, - actual, - expected, - false, - ) - }) - def('toBeLessThan', function (expected: number | bigint) { - const actual = this._obj as number | bigint - assertTypes(actual, 'actual', ['number', 'bigint']) - assertTypes(expected, 'expected', ['number', 'bigint']) - return this.assert( - actual < expected, - `expected ${actual} to be less than ${expected}`, - `expected ${actual} to be not less than ${expected}`, - actual, - expected, - false, - ) - }) - def('toBeLessThanOrEqual', function (expected: number | bigint) { - const actual = this._obj as number | bigint - assertTypes(actual, 'actual', ['number', 'bigint']) - assertTypes(expected, 'expected', ['number', 'bigint']) - return this.assert( - actual <= expected, - `expected ${actual} to be less than or equal to ${expected}`, - `expected ${actual} to be not less than or equal to ${expected}`, - actual, - expected, - false, - ) - }) - def('toBeNaN', function () { - return this.be.NaN - }) - def('toBeUndefined', function () { - return this.be.undefined - }) - def('toBeNull', function () { - return this.be.null - }) - def('toBeDefined', function () { - const negate = utils.flag(this, 'negate') - utils.flag(this, 'negate', false) - - if (negate) - return this.be.undefined - - return this.not.be.undefined - }) - def('toBeTypeOf', function (expected: 'bigint' | 'boolean' | 'function' | 'number' | 'object' | 'string' | 'symbol' | 'undefined') { - const actual = typeof this._obj - const equal = expected === actual - return this.assert( - equal, - 'expected #{this} to be type of #{exp}', - 'expected #{this} not to be type of #{exp}', - expected, - actual, - ) - }) - def('toBeInstanceOf', function (obj: any) { - return this.instanceOf(obj) - }) - def('toHaveLength', function (length: number) { - return this.have.length(length) - }) - // destructuring, because it checks `arguments` inside, and value is passing as `undefined` - def('toHaveProperty', function (...args: [property: string | (string | number)[], value?: any]) { - if (Array.isArray(args[0])) - args[0] = args[0].map(key => String(key).replace(/([.[\]])/g, '\\$1')).join('.') - - const actual = this._obj as any - const [propertyName, expected] = args - const getValue = () => { - const hasOwn = Object.prototype.hasOwnProperty.call(actual, propertyName) - if (hasOwn) - return {value: actual[propertyName], exists: true} - return utils.getPathInfo(actual, propertyName) - } - const {value, exists} = getValue() - const pass = exists && (args.length === 1 || jestEquals(expected, value, customTesters)) - - const valueString = args.length === 1 ? '' : ` with value ${utils.objDisplay(expected)}` - - return this.assert( - pass, - `expected #{this} to have property "${propertyName}"${valueString}`, - `expected #{this} to not have property "${propertyName}"${valueString}`, - expected, - exists ? value : undefined, - ) - }) - def('toBeCloseTo', function (received: number, precision = 2) { - const expected = this._obj - let pass = false - let expectedDiff = 0 - let receivedDiff = 0 - - if (received === Number.POSITIVE_INFINITY && expected === Number.POSITIVE_INFINITY) { - pass = true - } else if (received === Number.NEGATIVE_INFINITY && expected === Number.NEGATIVE_INFINITY) { - pass = true - } else { - expectedDiff = 10 ** -precision / 2 - receivedDiff = Math.abs(expected - received) - pass = receivedDiff < expectedDiff + // if it got here, it's already resolved + // unless it tries to resolve to a function that should throw + // called as '.resolves[.not].toThrow()` + else if (promise === "resolves" && typeof object !== "function") { + if (!isNot) { + const message = + utils.flag(this, "message") || + "expected promise to throw an error, but it didn't"; + const error = { + showDiff: false, + }; + throw new AssertionError(message, error, utils.flag(this, "ssfi")); + } else { + return; + } } - return this.assert( - pass, - `expected #{this} to be close to #{exp}, received difference is ${receivedDiff}, but expected ${expectedDiff}`, - `expected #{this} to not be close to #{exp}, received difference is ${receivedDiff}, but expected ${expectedDiff}`, - received, - expected, - false, - ) - }) - - const ordinalOf = (i: number) => { - const j = i % 10 - const k = i % 100 - - if (j === 1 && k !== 11) - return `${i}st` - - if (j === 2 && k !== 12) - return `${i}nd` - - if (j === 3 && k !== 13) - return `${i}rd` - - return `${i}th` + _super.apply(this, args); + }; + }); + }); + + def("toEqual", function (expected) { + const actual = utils.flag(this, "object"); + const equal = jestEquals(actual, expected, [ + ...customTesters, + iterableEquality, + ]); + return this.assert( + equal, + "expected #{this} to deeply equal #{exp}", + "expected #{this} to not deeply equal #{exp}", + expected, + actual + ); + }); + + def("toStrictEqual", function (expected) { + const obj = utils.flag(this, "object"); + const equal = jestEquals( + obj, + expected, + [ + ...customTesters, + iterableEquality, + typeEquality, + sparseArrayEquality, + arrayBufferEquality, + ], + true + ); + + return this.assert( + equal, + "expected #{this} to strictly equal #{exp}", + "expected #{this} to not strictly equal #{exp}", + expected, + obj + ); + }); + def("toBe", function (expected) { + const actual = this._obj; + const pass = Object.is(actual, expected); + + let deepEqualityName = ""; + + if (!pass) { + const toStrictEqualPass = jestEquals( + actual, + expected, + [ + ...customTesters, + iterableEquality, + typeEquality, + sparseArrayEquality, + arrayBufferEquality, + ], + true + ); + + if (toStrictEqualPass) { + deepEqualityName = "toStrictEqual"; + } else { + const toEqualPass = jestEquals(actual, expected, [ + ...customTesters, + iterableEquality, + ]); + + if (toEqualPass) deepEqualityName = "toEqual"; + } } - def(['toThrow', 'toThrowError'], function (expected?: string | RegExp | Error) { - if (typeof expected === 'string' || typeof expected === 'undefined' || expected instanceof RegExp) - return this.throws(expected) - - const obj = this._obj - const promise = utils.flag(this, 'promise') - const isNot = utils.flag(this, 'negate') as boolean - let thrown: any = null - - if (promise === 'rejects') { - thrown = obj - } - // if it got here, it's already resolved - // unless it tries to resolve to a function that should throw - // called as .resolves.toThrow(Error) - else if (promise === 'resolves' && typeof obj !== 'function') { - if (!isNot) { - const message = utils.flag(this, 'message') || 'expected promise to throw an error, but it didn\'t' - const error = { - showDiff: false, - } - throw new AssertionError(message, error, utils.flag(this, 'ssfi')) - } else { - return - } + return this.assert( + pass, + generateToBeMessage(deepEqualityName), + "expected #{this} not to be #{exp} // Object.is equality", + expected, + actual + ); + }); + def("toMatchObject", function (expected) { + const actual = this._obj; + return this.assert( + jestEquals(actual, expected, [ + ...customTesters, + iterableEquality, + subsetEquality, + ]), + "expected #{this} to match object #{exp}", + "expected #{this} to not match object #{exp}", + expected, + actual + ); + }); + def("toMatch", function (expected: string | RegExp) { + if (typeof expected === "string") return this.include(expected); + else return this.match(expected); + }); + def("toContain", function (item) { + const actual = this._obj as Iterable | string; + + // make "actual" indexable to have compatibility with jest + if (actual != null && typeof actual !== "string") + utils.flag(this, "object", Array.from(actual as Iterable)); + return this.contain(item); + }); + def("toContainEqual", function (expected) { + const obj = utils.flag(this, "object"); + const index = Array.from(obj).findIndex((item) => { + return jestEquals(item, expected, customTesters); + }); + + this.assert( + index !== -1, + "expected #{this} to deep equally contain #{exp}", + "expected #{this} to not deep equally contain #{exp}", + expected + ); + }); + def("toBeTruthy", function () { + const obj = utils.flag(this, "object"); + this.assert( + Boolean(obj), + "expected #{this} to be truthy", + "expected #{this} to not be truthy", + obj, + false + ); + }); + def("toBeFalsy", function () { + const obj = utils.flag(this, "object"); + this.assert( + !obj, + "expected #{this} to be falsy", + "expected #{this} to not be falsy", + obj, + false + ); + }); + def("toBeGreaterThan", function (expected: number | bigint) { + const actual = this._obj as number | bigint; + assertTypes(actual, "actual", ["number", "bigint"]); + assertTypes(expected, "expected", ["number", "bigint"]); + return this.assert( + actual > expected, + `expected ${actual} to be greater than ${expected}`, + `expected ${actual} to be not greater than ${expected}`, + actual, + expected, + false + ); + }); + def("toBeGreaterThanOrEqual", function (expected: number | bigint) { + const actual = this._obj as number | bigint; + assertTypes(actual, "actual", ["number", "bigint"]); + assertTypes(expected, "expected", ["number", "bigint"]); + return this.assert( + actual >= expected, + `expected ${actual} to be greater than or equal to ${expected}`, + `expected ${actual} to be not greater than or equal to ${expected}`, + actual, + expected, + false + ); + }); + def("toBeLessThan", function (expected: number | bigint) { + const actual = this._obj as number | bigint; + assertTypes(actual, "actual", ["number", "bigint"]); + assertTypes(expected, "expected", ["number", "bigint"]); + return this.assert( + actual < expected, + `expected ${actual} to be less than ${expected}`, + `expected ${actual} to be not less than ${expected}`, + actual, + expected, + false + ); + }); + def("toBeLessThanOrEqual", function (expected: number | bigint) { + const actual = this._obj as number | bigint; + assertTypes(actual, "actual", ["number", "bigint"]); + assertTypes(expected, "expected", ["number", "bigint"]); + return this.assert( + actual <= expected, + `expected ${actual} to be less than or equal to ${expected}`, + `expected ${actual} to be not less than or equal to ${expected}`, + actual, + expected, + false + ); + }); + def("toBeNaN", function () { + return this.be.NaN; + }); + def("toBeUndefined", function () { + return this.be.undefined; + }); + def("toBeNull", function () { + return this.be.null; + }); + def("toBeDefined", function () { + const negate = utils.flag(this, "negate"); + utils.flag(this, "negate", false); + + if (negate) return this.be.undefined; + + return this.not.be.undefined; + }); + def( + "toBeTypeOf", + function ( + expected: + | "bigint" + | "boolean" + | "function" + | "number" + | "object" + | "string" + | "symbol" + | "undefined" + ) { + const actual = typeof this._obj; + const equal = expected === actual; + return this.assert( + equal, + "expected #{this} to be type of #{exp}", + "expected #{this} not to be type of #{exp}", + expected, + actual + ); + } + ); + def("toBeInstanceOf", function (obj: any) { + return this.instanceOf(obj); + }); + def("toHaveLength", function (length: number) { + return this.have.length(length); + }); + // destructuring, because it checks `arguments` inside, and value is passing as `undefined` + def( + "toHaveProperty", + function (...args: [property: string | (string | number)[], value?: any]) { + if (Array.isArray(args[0])) + args[0] = args[0] + .map((key) => String(key).replace(/([.[\]])/g, "\\$1")) + .join("."); + + const actual = this._obj as any; + const [propertyName, expected] = args; + const getValue = () => { + const hasOwn = Object.prototype.hasOwnProperty.call( + actual, + propertyName + ); + if (hasOwn) return { value: actual[propertyName], exists: true }; + return utils.getPathInfo(actual, propertyName); + }; + const { value, exists } = getValue(); + const pass = + exists && + (args.length === 1 || jestEquals(expected, value, customTesters)); + + const valueString = + args.length === 1 ? "" : ` with value ${utils.objDisplay(expected)}`; + + return this.assert( + pass, + `expected #{this} to have property "${propertyName}"${valueString}`, + `expected #{this} to not have property "${propertyName}"${valueString}`, + expected, + exists ? value : undefined + ); + } + ); + def("toBeCloseTo", function (received: number, precision = 2) { + const expected = this._obj; + let pass = false; + let expectedDiff = 0; + let receivedDiff = 0; + + if ( + received === Number.POSITIVE_INFINITY && + expected === Number.POSITIVE_INFINITY + ) { + pass = true; + } else if ( + received === Number.NEGATIVE_INFINITY && + expected === Number.NEGATIVE_INFINITY + ) { + pass = true; + } else { + expectedDiff = 10 ** -precision / 2; + receivedDiff = Math.abs(expected - received); + pass = receivedDiff < expectedDiff; + } + return this.assert( + pass, + `expected #{this} to be close to #{exp}, received difference is ${receivedDiff}, but expected ${expectedDiff}`, + `expected #{this} to not be close to #{exp}, received difference is ${receivedDiff}, but expected ${expectedDiff}`, + received, + expected, + false + ); + }); + + const ordinalOf = (i: number) => { + const j = i % 10; + const k = i % 100; + + if (j === 1 && k !== 11) return `${i}st`; + + if (j === 2 && k !== 12) return `${i}nd`; + + if (j === 3 && k !== 13) return `${i}rd`; + + return `${i}th`; + }; + + def( + ["toThrow", "toThrowError"], + function (expected?: string | RegExp | Error) { + if ( + typeof expected === "string" || + typeof expected === "undefined" || + expected instanceof RegExp + ) + return this.throws(expected); + + const obj = this._obj; + const promise = utils.flag(this, "promise"); + const isNot = utils.flag(this, "negate") as boolean; + let thrown: any = null; + + if (promise === "rejects") { + thrown = obj; + } + // if it got here, it's already resolved + // unless it tries to resolve to a function that should throw + // called as .resolves.toThrow(Error) + else if (promise === "resolves" && typeof obj !== "function") { + if (!isNot) { + const message = + utils.flag(this, "message") || + "expected promise to throw an error, but it didn't"; + const error = { + showDiff: false, + }; + throw new AssertionError(message, error, utils.flag(this, "ssfi")); } else { - let isThrow = false - try { - obj() - } catch (err) { - isThrow = true - thrown = err - } - - if (!isThrow && !isNot) { - const message = utils.flag(this, 'message') || 'expected function to throw an error, but it didn\'t' - const error = { - showDiff: false, - } - throw new AssertionError(message, error, utils.flag(this, 'ssfi')) - } + return; } - - if (typeof expected === 'function') { - // @ts-ignore - const name = expected.name || expected.prototype.constructor.name - return this.assert( - thrown && thrown instanceof expected, - `expected error to be instance of ${name}`, - `expected error not to be instance of ${name}`, - expected, - thrown, - ) - } - - if (expected instanceof Error) { - return this.assert( - thrown && expected.message === thrown.message, - `expected error to have message: ${expected.message}`, - `expected error not to have message: ${expected.message}`, - expected.message, - thrown && thrown.message, - ) + } else { + let isThrow = false; + try { + obj(); + } catch (err) { + isThrow = true; + thrown = err; } - if (typeof expected === 'object' && 'asymmetricMatch' in expected && typeof (expected as any).asymmetricMatch === 'function') { - const matcher = expected as any as AsymmetricMatcher - return this.assert( - thrown && matcher.asymmetricMatch(thrown), - 'expected error to match asymmetric matcher', - 'expected error not to match asymmetric matcher', - matcher, - thrown, - ) + if (!isThrow && !isNot) { + const message = + utils.flag(this, "message") || + "expected function to throw an error, but it didn't"; + const error = { + showDiff: false, + }; + throw new AssertionError(message, error, utils.flag(this, "ssfi")); } + } - throw new Error(`"toThrow" expects string, RegExp, function, Error instance or asymmetric matcher, got "${typeof expected}"`) - }) - - def('toSatisfy', function (matcher: Function, message?: string) { - return this.be.satisfy(matcher, message) - }) - - utils.addProperty(chai.Assertion.prototype, 'resolves', function __VITEST_RESOLVES__(this: any) { - const error = new Error('resolves') - utils.flag(this, 'promise', 'resolves') - utils.flag(this, 'error', error) - const test: any = utils.flag(this, 'vitest-test') - const obj = utils.flag(this, 'object') - - if (typeof obj?.then !== 'function') - throw new TypeError(`You must provide a Promise to expect() when using .resolves, not '${typeof obj}'.`) - - const proxy: any = new Proxy(this, { - get: (target, key, receiver) => { - const result = Reflect.get(target, key, receiver) - - if (typeof result !== 'function') - return result instanceof chai.Assertion ? proxy : result - - return async (...args: any[]) => { - const promise = obj.then( - (value: any) => { - utils.flag(this, 'object', value) - return result.call(this, ...args) - }, - (err: any) => { - const _error = new AssertionError( - `promise rejected "${utils.inspect(err)}" instead of resolving`, - {showDiff: false}, - ) as Error - // @ts-ignore - _error.cause = err - _error.stack = (error.stack as string).replace(error.message, _error.message) - throw _error - }, - ) - - return recordAsyncExpect(test, promise) - } - }, - }) - - return proxy - }) - - utils.addProperty(chai.Assertion.prototype, 'rejects', function __VITEST_REJECTS__(this: any) { - const error = new Error('rejects') - utils.flag(this, 'promise', 'rejects') - utils.flag(this, 'error', error) - const test: any = utils.flag(this, 'vitest-test') - const obj = utils.flag(this, 'object') - const wrapper = typeof obj === 'function' ? obj() : obj // for jest compat - - if (typeof wrapper?.then !== 'function') - throw new TypeError(`You must provide a Promise to expect() when using .rejects, not '${typeof wrapper}'.`) - - const proxy: any = new Proxy(this, { - get: (target, key, receiver) => { - const result = Reflect.get(target, key, receiver) - - if (typeof result !== 'function') - return result instanceof chai.Assertion ? proxy : result - - return async (...args: any[]) => { - const promise = wrapper.then( - (value: any) => { - const _error = new AssertionError( - `promise resolved "${utils.inspect(value)}" instead of rejecting`, - {showDiff: true, expected: new Error('rejected promise'), actual: value}, - ) as any - _error.stack = (error.stack as string).replace(error.message, _error.message) - throw _error - }, - (err: any) => { - utils.flag(this, 'object', err) - return result.call(this, ...args) - }, - ) - - return recordAsyncExpect(test, promise) - } - }, - }) - - return proxy - }) -} - - -export function assertTypes(value: unknown, name: string, types: string[]): void { - const receivedType = typeof value - const pass = types.includes(receivedType) - if (!pass) - throw new TypeError(`${name} value must be ${types.join(' or ')}, received "${receivedType}"`) -} - - -export function recordAsyncExpect(test: any, promise: Promise | PromiseLike) { - // record promise for test, that resolves before test ends - if (test && promise instanceof Promise) { - // if promise is explicitly awaited, remove it from the list - promise = promise.finally(() => { - const index = test.promises.indexOf(promise) - if (index !== -1) - test.promises.splice(index, 1) - }) - - // record promise - if (!test.promises) - test.promises = [] - test.promises.push(promise) + if (typeof expected === "function") { + // @ts-ignore + const name = expected.name || expected.prototype.constructor.name; + return this.assert( + thrown && thrown instanceof expected, + `expected error to be instance of ${name}`, + `expected error not to be instance of ${name}`, + expected, + thrown + ); + } + + if (expected instanceof Error) { + return this.assert( + thrown && expected.message === thrown.message, + `expected error to have message: ${expected.message}`, + `expected error not to have message: ${expected.message}`, + expected.message, + thrown && thrown.message + ); + } + + if ( + typeof expected === "object" && + "asymmetricMatch" in expected && + typeof (expected as any).asymmetricMatch === "function" + ) { + const matcher = expected as any as AsymmetricMatcher; + return this.assert( + thrown && matcher.asymmetricMatch(thrown), + "expected error to match asymmetric matcher", + "expected error not to match asymmetric matcher", + matcher, + thrown + ); + } + + throw new Error( + `"toThrow" expects string, RegExp, function, Error instance or asymmetric matcher, got "${typeof expected}"` + ); } + ); + + def("toSatisfy", function (matcher: Function, message?: string) { + return this.be.satisfy(matcher, message); + }); + + utils.addProperty( + chai.Assertion.prototype, + "resolves", + function __VITEST_RESOLVES__(this: any) { + const error = new Error("resolves"); + utils.flag(this, "promise", "resolves"); + utils.flag(this, "error", error); + const test: any = utils.flag(this, "vitest-test"); + const obj = utils.flag(this, "object"); + + if (typeof obj?.then !== "function") + throw new TypeError( + `You must provide a Promise to expect() when using .resolves, not '${typeof obj}'.` + ); + + const proxy: any = new Proxy(this, { + get: (target, key, receiver) => { + const result = Reflect.get(target, key, receiver); + + if (typeof result !== "function") + return result instanceof chai.Assertion ? proxy : result; + + return async (...args: any[]) => { + const promise = obj.then( + (value: any) => { + utils.flag(this, "object", value); + return result.call(this, ...args); + }, + (err: any) => { + const _error = new AssertionError( + `promise rejected "${utils.inspect(err)}" instead of resolving`, + { showDiff: false } + ) as Error; + // @ts-ignore + _error.cause = err; + _error.stack = (error.stack as string).replace( + error.message, + _error.message + ); + throw _error; + } + ); + + return recordAsyncExpect(test, promise); + }; + }, + }); + + return proxy; + } + ); + + utils.addProperty( + chai.Assertion.prototype, + "rejects", + function __VITEST_REJECTS__(this: any) { + const error = new Error("rejects"); + utils.flag(this, "promise", "rejects"); + utils.flag(this, "error", error); + const test: any = utils.flag(this, "vitest-test"); + const obj = utils.flag(this, "object"); + const wrapper = typeof obj === "function" ? obj() : obj; // for jest compat + + if (typeof wrapper?.then !== "function") + throw new TypeError( + `You must provide a Promise to expect() when using .rejects, not '${typeof wrapper}'.` + ); + + const proxy: any = new Proxy(this, { + get: (target, key, receiver) => { + const result = Reflect.get(target, key, receiver); + + if (typeof result !== "function") + return result instanceof chai.Assertion ? proxy : result; + + return async (...args: any[]) => { + const promise = wrapper.then( + (value: any) => { + const _error = new AssertionError( + `promise resolved "${utils.inspect(value)}" instead of rejecting`, + { + showDiff: true, + expected: new Error("rejected promise"), + actual: value, + } + ) as any; + _error.stack = (error.stack as string).replace( + error.message, + _error.message + ); + throw _error; + }, + (err: any) => { + utils.flag(this, "object", err); + return result.call(this, ...args); + } + ); + + return recordAsyncExpect(test, promise); + }; + }, + }); + + return proxy; + } + ); +}; + +export function assertTypes( + value: unknown, + name: string, + types: string[] +): void { + const receivedType = typeof value; + const pass = types.includes(receivedType); + if (!pass) + throw new TypeError( + `${name} value must be ${types.join(" or ")}, received "${receivedType}"` + ); +} - return promise +export function recordAsyncExpect( + test: any, + promise: Promise | PromiseLike +) { + // record promise for test, that resolves before test ends + if (test && promise instanceof Promise) { + // if promise is explicitly awaited, remove it from the list + promise = promise.finally(() => { + const index = test.promises.indexOf(promise); + if (index !== -1) test.promises.splice(index, 1); + }); + + // record promise + if (!test.promises) test.promises = []; + test.promises.push(promise); + } + + return promise; } diff --git a/src/js/@llrt/expect/jest-utils.ts b/src/js/@llrt/expect/jest-utils.ts index 5a8a207405..25ecf6fb32 100644 --- a/src/js/@llrt/expect/jest-utils.ts +++ b/src/js/@llrt/expect/jest-utils.ts @@ -25,7 +25,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // Extracted and modified from Vitest: https://github.com/vitest-dev/vitest/blob/463bee38463cd66f9b1f11983a787d9e0e3a7dea/packages/expect/src/jest-utils.ts export function isObject(item: unknown): boolean { - return item != null && typeof item === 'object' && !Array.isArray(item) + return item != null && typeof item === "object" && !Array.isArray(item); } // import type { Tester, TesterContext } from './types' @@ -34,45 +34,44 @@ export function equals( a: unknown, b: unknown, customTesters?: Array, - strictCheck?: boolean, + strictCheck?: boolean ): boolean { - customTesters = customTesters || [] - return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey) + customTesters = customTesters || []; + return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey); } -const functionToString = Function.prototype.toString +const functionToString = Function.prototype.toString; export function isAsymmetric(obj: any) { - return !!obj && typeof obj === 'object' && 'asymmetricMatch' in obj && isA('Function', obj.asymmetricMatch) + return ( + !!obj && + typeof obj === "object" && + "asymmetricMatch" in obj && + isA("Function", obj.asymmetricMatch) + ); } export function hasAsymmetric(obj: any, seen = new Set()): boolean { - if (seen.has(obj)) - return false - seen.add(obj) - if (isAsymmetric(obj)) - return true - if (Array.isArray(obj)) - return obj.some(i => hasAsymmetric(i, seen)) + if (seen.has(obj)) return false; + seen.add(obj); + if (isAsymmetric(obj)) return true; + if (Array.isArray(obj)) return obj.some((i) => hasAsymmetric(i, seen)); if (obj instanceof Set) - return Array.from(obj).some(i => hasAsymmetric(i, seen)) + return Array.from(obj).some((i) => hasAsymmetric(i, seen)); if (isObject(obj)) - return Object.values(obj).some(v => hasAsymmetric(v, seen)) - return false + return Object.values(obj).some((v) => hasAsymmetric(v, seen)); + return false; } function asymmetricMatch(a: any, b: any) { - const asymmetricA = isAsymmetric(a) - const asymmetricB = isAsymmetric(b) + const asymmetricA = isAsymmetric(a); + const asymmetricB = isAsymmetric(b); - if (asymmetricA && asymmetricB) - return undefined + if (asymmetricA && asymmetricB) return undefined; - if (asymmetricA) - return a.asymmetricMatch(b) + if (asymmetricA) return a.asymmetricMatch(b); - if (asymmetricB) - return b.asymmetricMatch(a) + if (asymmetricB) return b.asymmetricMatch(a); } // Equality function lovingly adapted from isEqual in @@ -83,211 +82,194 @@ function eq( aStack: Array, bStack: Array, customTesters: Array, - hasKey: any, + hasKey: any ): boolean { - let result = true + let result = true; - const asymmetricResult = asymmetricMatch(a, b) - if (asymmetricResult !== undefined) - return asymmetricResult + const asymmetricResult = asymmetricMatch(a, b); + if (asymmetricResult !== undefined) return asymmetricResult; - const testerContext: any = { equals } + const testerContext: any = { equals }; for (let i = 0; i < customTesters.length; i++) { - const customTesterResult = customTesters[i].call(testerContext, a, b, customTesters) - if (customTesterResult !== undefined) - return customTesterResult + const customTesterResult = customTesters[i].call( + testerContext, + a, + b, + customTesters + ); + if (customTesterResult !== undefined) return customTesterResult; } - if (a instanceof Error && b instanceof Error) - return a.message === b.message + if (a instanceof Error && b instanceof Error) return a.message === b.message; - if (typeof URL === 'function' && a instanceof URL && b instanceof URL) - return a.href === b.href + if (typeof URL === "function" && a instanceof URL && b instanceof URL) + return a.href === b.href; - if (Object.is(a, b)) - return true + if (Object.is(a, b)) return true; // A strict comparison is necessary because `null == undefined`. - if (a === null || b === null) - return a === b + if (a === null || b === null) return a === b; - const className = Object.prototype.toString.call(a) - if (className !== Object.prototype.toString.call(b)) - return false + const className = Object.prototype.toString.call(a); + if (className !== Object.prototype.toString.call(b)) return false; switch (className) { - case '[object Boolean]': - case '[object String]': - case '[object Number]': + case "[object Boolean]": + case "[object String]": + case "[object Number]": if (typeof a !== typeof b) { // One is a primitive, one a `new Primitive()` - return false - } - else if (typeof a !== 'object' && typeof b !== 'object') { + return false; + } else if (typeof a !== "object" && typeof b !== "object") { // both are proper primitives - return Object.is(a, b) - } - else { + return Object.is(a, b); + } else { // both are `new Primitive()`s - return Object.is(a.valueOf(), b.valueOf()) + return Object.is(a.valueOf(), b.valueOf()); } - case '[object Date]': { - const numA = +a - const numB = +b + case "[object Date]": { + const numA = +a; + const numB = +b; // Coerce dates to numeric primitive values. Dates are compared by their // millisecond representations. Note that invalid dates with millisecond representations // of `NaN` are equivalent. - return (numA === numB) || (Number.isNaN(numA) && Number.isNaN(numB)) + return numA === numB || (Number.isNaN(numA) && Number.isNaN(numB)); } // RegExps are compared by their source patterns and flags. - case '[object RegExp]': - return a.source === b.source && a.flags === b.flags + case "[object RegExp]": + return a.source === b.source && a.flags === b.flags; } - if (typeof a !== 'object' || typeof b !== 'object') - return false + if (typeof a !== "object" || typeof b !== "object") return false; // Use DOM3 method isEqualNode (IE>=9) - if (isDomNode(a) && isDomNode(b)) - return a.isEqualNode(b) + if (isDomNode(a) && isDomNode(b)) return a.isEqualNode(b); // Used to detect circular references. - let length = aStack.length + let length = aStack.length; while (length--) { // Linear search. Performance is inversely proportional to the number of // unique nested structures. // circular references at same depth are equal // circular reference is not equal to non-circular one - if (aStack[length] === a) - return bStack[length] === b - - else if (bStack[length] === b) - return false + if (aStack[length] === a) return bStack[length] === b; + else if (bStack[length] === b) return false; } // Add the first object to the stack of traversed objects. - aStack.push(a) - bStack.push(b) + aStack.push(a); + bStack.push(b); // Recursively compare objects and arrays. // Compare array lengths to determine if a deep comparison is necessary. - if (className === '[object Array]' && a.length !== b.length) - return false + if (className === "[object Array]" && a.length !== b.length) return false; // Deep compare objects. - const aKeys = keys(a, hasKey) - let key - let size = aKeys.length + const aKeys = keys(a, hasKey); + let key; + let size = aKeys.length; // Ensure that both objects contain the same number of properties before comparing deep equality. - if (keys(b, hasKey).length !== size) - return false + if (keys(b, hasKey).length !== size) return false; while (size--) { - key = aKeys[size] + key = aKeys[size]; // Deep compare each member - result - = hasKey(b, key) - && eq(a[key], b[key], aStack, bStack, customTesters, hasKey) + result = + hasKey(b, key) && + eq(a[key], b[key], aStack, bStack, customTesters, hasKey); - if (!result) - return false + if (!result) return false; } // Remove the first object from the stack of traversed objects. - aStack.pop() - bStack.pop() + aStack.pop(); + bStack.pop(); - return result + return result; } function keys(obj: object, hasKey: (obj: object, key: string) => boolean) { - const keys = [] + const keys = []; for (const key in obj) { - if (hasKey(obj, key)) - keys.push(key) + if (hasKey(obj, key)) keys.push(key); } return keys.concat( (Object.getOwnPropertySymbols(obj) as Array).filter( - symbol => + (symbol) => (Object.getOwnPropertyDescriptor(obj, symbol) as PropertyDescriptor) - .enumerable, - ), - ) + .enumerable + ) + ); } function hasDefinedKey(obj: any, key: string) { - return hasKey(obj, key) && obj[key] !== undefined + return hasKey(obj, key) && obj[key] !== undefined; } function hasKey(obj: any, key: string) { - return Object.prototype.hasOwnProperty.call(obj, key) + return Object.prototype.hasOwnProperty.call(obj, key); } export function isA(typeName: string, value: unknown) { - return Object.prototype.toString.apply(value) === `[object ${typeName}]` + return Object.prototype.toString.apply(value) === `[object ${typeName}]`; } function isDomNode(obj: any): boolean { return ( - obj !== null - && typeof obj === 'object' - && 'nodeType' in obj - && typeof obj.nodeType === 'number' - && 'nodeName' in obj - && typeof obj.nodeName === 'string' - && 'isEqualNode' in obj - && typeof obj.isEqualNode === 'function' - ) + obj !== null && + typeof obj === "object" && + "nodeType" in obj && + typeof obj.nodeType === "number" && + "nodeName" in obj && + typeof obj.nodeName === "string" && + "isEqualNode" in obj && + typeof obj.isEqualNode === "function" + ); } export function fnNameFor(func: Function) { - if (func.name) - return func.name + if (func.name) return func.name; const matches = functionToString .call(func) - .match(/^(?:async)?\s*function\s*\*?\s*([\w$]+)\s*\(/) - return matches ? matches[1] : '' + .match(/^(?:async)?\s*function\s*\*?\s*([\w$]+)\s*\(/); + return matches ? matches[1] : ""; } function getPrototype(obj: object) { - if (Object.getPrototypeOf) - return Object.getPrototypeOf(obj) + if (Object.getPrototypeOf) return Object.getPrototypeOf(obj); - if (obj.constructor.prototype === obj) - return null + if (obj.constructor.prototype === obj) return null; - return obj.constructor.prototype + return obj.constructor.prototype; } export function hasProperty(obj: object | null, property: string): boolean { - if (!obj) - return false + if (!obj) return false; - if (Object.prototype.hasOwnProperty.call(obj, property)) - return true + if (Object.prototype.hasOwnProperty.call(obj, property)) return true; - return hasProperty(getPrototype(obj), property) + return hasProperty(getPrototype(obj), property); } // SENTINEL constants are from https://github.com/facebook/immutable-js -const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@' -const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@' -const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@' +const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@"; +const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@"; +const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@"; export function isImmutableUnorderedKeyed(maybeKeyed: any) { return !!( - maybeKeyed - && maybeKeyed[IS_KEYED_SENTINEL] - && !maybeKeyed[IS_ORDERED_SENTINEL] - ) + maybeKeyed && + maybeKeyed[IS_KEYED_SENTINEL] && + !maybeKeyed[IS_ORDERED_SENTINEL] + ); } export function isImmutableUnorderedSet(maybeSet: any) { return !!( - maybeSet - && maybeSet[IS_SET_SENTINEL] - && !maybeSet[IS_ORDERED_SENTINEL] - ) + maybeSet && + maybeSet[IS_SET_SENTINEL] && + !maybeSet[IS_ORDERED_SENTINEL] + ); } /** @@ -297,42 +279,46 @@ export function isImmutableUnorderedSet(maybeSet: any) { * LICENSE file in the root directory of this source tree. * */ -const IteratorSymbol = Symbol.iterator +const IteratorSymbol = Symbol.iterator; function hasIterator(object: any) { - return !!(object != null && object[IteratorSymbol]) + return !!(object != null && object[IteratorSymbol]); } -export function iterableEquality(a: any, b: any, customTesters: Array = [], aStack: Array = [], bStack: Array = []): boolean | undefined { +export function iterableEquality( + a: any, + b: any, + customTesters: Array = [], + aStack: Array = [], + bStack: Array = [] +): boolean | undefined { if ( - typeof a !== 'object' - || typeof b !== 'object' - || Array.isArray(a) - || Array.isArray(b) - || !hasIterator(a) - || !hasIterator(b) + typeof a !== "object" || + typeof b !== "object" || + Array.isArray(a) || + Array.isArray(b) || + !hasIterator(a) || + !hasIterator(b) ) - return undefined + return undefined; - if (a.constructor !== b.constructor) - return false + if (a.constructor !== b.constructor) return false; - let length = aStack.length + let length = aStack.length; while (length--) { // Linear search. Performance is inversely proportional to the number of // unique nested structures. // circular references at same depth are equal // circular reference is not equal to non-circular one - if (aStack[length] === a) - return bStack[length] === b + if (aStack[length] === a) return bStack[length] === b; } - aStack.push(a) - bStack.push(b) + aStack.push(a); + bStack.push(b); const filteredCustomTesters: Array = [ - ...customTesters.filter(t => t !== iterableEquality), + ...customTesters.filter((t) => t !== iterableEquality), iterableEqualityWithStack, - ] + ]; function iterableEqualityWithStack(a: any, b: any) { return iterableEquality( @@ -340,209 +326,220 @@ export function iterableEquality(a: any, b: any, customTesters: Array = [], b, [...filteredCustomTesters], [...aStack], - [...bStack], - ) + [...bStack] + ); } if (a.size !== undefined) { if (a.size !== b.size) { - return false - } - else if (isA('Set', a) || isImmutableUnorderedSet(a)) { - let allFound = true + return false; + } else if (isA("Set", a) || isImmutableUnorderedSet(a)) { + let allFound = true; for (const aValue of a) { if (!b.has(aValue)) { - let has = false + let has = false; for (const bValue of b) { - const isEqual = equals(aValue, bValue, filteredCustomTesters) - if (isEqual === true) - has = true + const isEqual = equals(aValue, bValue, filteredCustomTesters); + if (isEqual === true) has = true; } if (has === false) { - allFound = false - break + allFound = false; + break; } } } // Remove the first value from the stack of traversed values. - aStack.pop() - bStack.pop() - return allFound - } - else if (isA('Map', a) || isImmutableUnorderedKeyed(a)) { - let allFound = true + aStack.pop(); + bStack.pop(); + return allFound; + } else if (isA("Map", a) || isImmutableUnorderedKeyed(a)) { + let allFound = true; for (const aEntry of a) { if ( - !b.has(aEntry[0]) - || !equals(aEntry[1], b.get(aEntry[0]), filteredCustomTesters) + !b.has(aEntry[0]) || + !equals(aEntry[1], b.get(aEntry[0]), filteredCustomTesters) ) { - let has = false + let has = false; for (const bEntry of b) { - const matchedKey = equals(aEntry[0], bEntry[0], filteredCustomTesters) + const matchedKey = equals( + aEntry[0], + bEntry[0], + filteredCustomTesters + ); - let matchedValue = false + let matchedValue = false; if (matchedKey === true) - matchedValue = equals(aEntry[1], bEntry[1], filteredCustomTesters) + matchedValue = equals( + aEntry[1], + bEntry[1], + filteredCustomTesters + ); - if (matchedValue === true) - has = true + if (matchedValue === true) has = true; } if (has === false) { - allFound = false - break + allFound = false; + break; } } } // Remove the first value from the stack of traversed values. - aStack.pop() - bStack.pop() - return allFound + aStack.pop(); + bStack.pop(); + return allFound; } } - const bIterator = b[IteratorSymbol]() + const bIterator = b[IteratorSymbol](); for (const aValue of a) { - const nextB = bIterator.next() - if ( - nextB.done - || !equals(aValue, nextB.value, filteredCustomTesters) - ) - return false + const nextB = bIterator.next(); + if (nextB.done || !equals(aValue, nextB.value, filteredCustomTesters)) + return false; } - if (!bIterator.next().done) - return false + if (!bIterator.next().done) return false; // Remove the first value from the stack of traversed values. - aStack.pop() - bStack.pop() - return true + aStack.pop(); + bStack.pop(); + return true; } /** * Checks if `hasOwnProperty(object, key)` up the prototype chain, stopping at `Object.prototype`. */ function hasPropertyInObject(object: object, key: string): boolean { - const shouldTerminate - = !object || typeof object !== 'object' || object === Object.prototype + const shouldTerminate = + !object || typeof object !== "object" || object === Object.prototype; - if (shouldTerminate) - return false + if (shouldTerminate) return false; return ( - Object.prototype.hasOwnProperty.call(object, key) - || hasPropertyInObject(Object.getPrototypeOf(object), key) - ) + Object.prototype.hasOwnProperty.call(object, key) || + hasPropertyInObject(Object.getPrototypeOf(object), key) + ); } function isObjectWithKeys(a: any) { - return isObject(a) - && !(a instanceof Error) - && !(Array.isArray(a)) - && !(a instanceof Date) + return ( + isObject(a) && + !(a instanceof Error) && + !Array.isArray(a) && + !(a instanceof Date) + ); } -export function subsetEquality(object: unknown, subset: unknown, customTesters: Array = []): boolean | undefined { - const filteredCustomTesters = customTesters.filter(t => t !== subsetEquality) +export function subsetEquality( + object: unknown, + subset: unknown, + customTesters: Array = [] +): boolean | undefined { + const filteredCustomTesters = customTesters.filter( + (t) => t !== subsetEquality + ); // subsetEquality needs to keep track of the references // it has already visited to avoid infinite loops in case // there are circular references in the subset passed to it. - const subsetEqualityWithContext - = (seenReferences: WeakMap = new WeakMap()) => - (object: any, subset: any): boolean | undefined => { - if (!isObjectWithKeys(subset)) - return undefined - - return Object.keys(subset).every((key) => { - if (isObjectWithKeys(subset[key])) { - if (seenReferences.has(subset[key])) - return equals(object[key], subset[key], filteredCustomTesters) - - seenReferences.set(subset[key], true) - } - const result - = object != null - && hasPropertyInObject(object, key) - && equals(object[key], subset[key], [ - ...filteredCustomTesters, - subsetEqualityWithContext(seenReferences), - ]) - // The main goal of using seenReference is to avoid circular node on tree. - // It will only happen within a parent and its child, not a node and nodes next to it (same level) - // We should keep the reference for a parent and its child only - // Thus we should delete the reference immediately so that it doesn't interfere - // other nodes within the same level on tree. - seenReferences.delete(subset[key]) - return result - }) - } + const subsetEqualityWithContext = + (seenReferences: WeakMap = new WeakMap()) => + (object: any, subset: any): boolean | undefined => { + if (!isObjectWithKeys(subset)) return undefined; + + return Object.keys(subset).every((key) => { + if (isObjectWithKeys(subset[key])) { + if (seenReferences.has(subset[key])) + return equals(object[key], subset[key], filteredCustomTesters); - return subsetEqualityWithContext()(object, subset) + seenReferences.set(subset[key], true); + } + const result = + object != null && + hasPropertyInObject(object, key) && + equals(object[key], subset[key], [ + ...filteredCustomTesters, + subsetEqualityWithContext(seenReferences), + ]); + // The main goal of using seenReference is to avoid circular node on tree. + // It will only happen within a parent and its child, not a node and nodes next to it (same level) + // We should keep the reference for a parent and its child only + // Thus we should delete the reference immediately so that it doesn't interfere + // other nodes within the same level on tree. + seenReferences.delete(subset[key]); + return result; + }); + }; + + return subsetEqualityWithContext()(object, subset); } export function typeEquality(a: any, b: any): boolean | undefined { if (a == null || b == null || a.constructor === b.constructor) - return undefined + return undefined; - return false + return false; } -export function arrayBufferEquality(a: unknown, b: unknown): boolean | undefined { - let dataViewA = a as DataView - let dataViewB = b as DataView +export function arrayBufferEquality( + a: unknown, + b: unknown +): boolean | undefined { + let dataViewA = a as DataView; + let dataViewB = b as DataView; if (!(a instanceof DataView && b instanceof DataView)) { if (!(a instanceof ArrayBuffer) || !(b instanceof ArrayBuffer)) - return undefined + return undefined; try { - dataViewA = new DataView(a) - dataViewB = new DataView(b) - } - catch { - return undefined + dataViewA = new DataView(a); + dataViewB = new DataView(b); + } catch { + return undefined; } } // Buffers are not equal when they do not have the same byte length - if (dataViewA.byteLength !== dataViewB.byteLength) - return false + if (dataViewA.byteLength !== dataViewB.byteLength) return false; // Check if every byte value is equal to each other for (let i = 0; i < dataViewA.byteLength; i++) { - if (dataViewA.getUint8(i) !== dataViewB.getUint8(i)) - return false + if (dataViewA.getUint8(i) !== dataViewB.getUint8(i)) return false; } - return true + return true; } -export function sparseArrayEquality(a: unknown, b: unknown, customTesters: Array = []): boolean | undefined { - if (!Array.isArray(a) || !Array.isArray(b)) - return undefined +export function sparseArrayEquality( + a: unknown, + b: unknown, + customTesters: Array = [] +): boolean | undefined { + if (!Array.isArray(a) || !Array.isArray(b)) return undefined; // A sparse array [, , 1] will have keys ["2"] whereas [undefined, undefined, 1] will have keys ["0", "1", "2"] - const aKeys = Object.keys(a) - const bKeys = Object.keys(b) - const filteredCustomTesters = customTesters.filter(t => t !== sparseArrayEquality) - return ( - equals(a, b, filteredCustomTesters, true) && equals(aKeys, bKeys) - ) + const aKeys = Object.keys(a); + const bKeys = Object.keys(b); + const filteredCustomTesters = customTesters.filter( + (t) => t !== sparseArrayEquality + ); + return equals(a, b, filteredCustomTesters, true) && equals(aKeys, bKeys); } -export function generateToBeMessage(deepEqualityName: string, expected = '#{this}', actual = '#{exp}') { - const toBeMessage = `expected ${expected} to be ${actual} // Object.is equality` +export function generateToBeMessage( + deepEqualityName: string, + expected = "#{this}", + actual = "#{exp}" +) { + const toBeMessage = `expected ${expected} to be ${actual} // Object.is equality`; - if (['toStrictEqual', 'toEqual'].includes(deepEqualityName)) - return `${toBeMessage}\n\nIf it should pass with deep equality, replace "toBe" with "${deepEqualityName}"\n\nExpected: ${expected}\nReceived: serializes to the same string\n` + if (["toStrictEqual", "toEqual"].includes(deepEqualityName)) + return `${toBeMessage}\n\nIf it should pass with deep equality, replace "toBe" with "${deepEqualityName}"\n\nExpected: ${expected}\nReceived: serializes to the same string\n`; - return toBeMessage + return toBeMessage; } export function pluralize(word: string, count: number): string { - return `${count} ${word}${count === 1 ? '' : 's'}` + return `${count} ${word}${count === 1 ? "" : "s"}`; } - - diff --git a/src/js/@llrt/expect/stringify.ts b/src/js/@llrt/expect/stringify.ts index 35197aff02..1be0b0b3bb 100644 --- a/src/js/@llrt/expect/stringify.ts +++ b/src/js/@llrt/expect/stringify.ts @@ -25,8 +25,11 @@ SOFTWARE. // Extracted and modified from Vitest: https://github.com/vitest-dev/vitest/blob/0f86ff98975a80191d6215b0d30ff6cd9f8388d3/packages/utils/src/stringify.ts -import type { PrettyFormatOptions } from 'pretty-format' -import { format as prettyFormat, plugins as prettyFormatPlugins } from 'pretty-format' +import type { PrettyFormatOptions } from "pretty-format"; +import { + format as prettyFormat, + plugins as prettyFormatPlugins, +} from "pretty-format"; const { AsymmetricMatcher, @@ -35,7 +38,7 @@ const { Immutable, ReactElement, ReactTestComponent, -} = prettyFormatPlugins +} = prettyFormatPlugins; const PLUGINS = [ ReactTestComponent, @@ -44,11 +47,15 @@ const PLUGINS = [ DOMCollection, Immutable, AsymmetricMatcher, -] +]; -export function stringify(object: unknown, maxDepth = 10, { maxLength, ...options }: PrettyFormatOptions & { maxLength?: number } = {}): string { - const MAX_LENGTH = maxLength ?? 10000 - let result +export function stringify( + object: unknown, + maxDepth = 10, + { maxLength, ...options }: PrettyFormatOptions & { maxLength?: number } = {} +): string { + const MAX_LENGTH = maxLength ?? 10000; + let result; try { result = prettyFormat(object, { @@ -57,9 +64,8 @@ export function stringify(object: unknown, maxDepth = 10, { maxLength, ...option // min: true, plugins: PLUGINS, ...options, - }) - } - catch { + }); + } catch { result = prettyFormat(object, { callToJSON: false, maxDepth, @@ -67,10 +73,10 @@ export function stringify(object: unknown, maxDepth = 10, { maxLength, ...option // min: true, plugins: PLUGINS, ...options, - }) + }); } - return (result.length >= MAX_LENGTH && maxDepth > 1) + return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) - : result + : result; } diff --git a/src/js/@llrt/test.ts b/src/js/@llrt/test.ts index ca3ca3264f..27ae994264 100644 --- a/src/js/@llrt/test.ts +++ b/src/js/@llrt/test.ts @@ -1,9 +1,9 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import assert from "assert"; -import * as chai from 'chai' -import {JestChaiExpect} from "./expect/jest-expect"; -import {JestAsymmetricMatchers} from "./expect/jest-asymmetric-matchers"; +import * as chai from "chai"; +import { JestChaiExpect } from "./expect/jest-expect"; +import { JestAsymmetricMatchers } from "./expect/jest-asymmetric-matchers"; const GLOBAL = globalThis as any; GLOBAL.assert = assert; @@ -185,16 +185,16 @@ const describe: any = createDescribe(); describe.only = createDescribe({ only: true }); describe.skip = createDescribe({ skip: true }); -chai.use(JestChaiExpect) -chai.use(JestAsymmetricMatchers) +chai.use(JestChaiExpect); +chai.use(JestAsymmetricMatchers); export function createExpect() { - const expect = ((value: any, message?: string): any => { - return chai.expect(value, message) as unknown as any - }) + const expect = (value: any, message?: string): any => { + return chai.expect(value, message) as unknown as any; + }; - Object.assign(expect, chai.expect) + Object.assign(expect, chai.expect); - return expect + return expect; } const expect: any = createExpect(); diff --git a/tests/e2e/IntegTestResourcesStack.template.yml b/tests/e2e/IntegTestResourcesStack.template.yml index 34f9be1f41..deef3e3f1f 100644 --- a/tests/e2e/IntegTestResourcesStack.template.yml +++ b/tests/e2e/IntegTestResourcesStack.template.yml @@ -47,7 +47,7 @@ Resources: CorsConfiguration: CorsRules: - AllowedHeaders: - - '*' + - "*" AllowedMethods: - GET - PUT @@ -55,7 +55,7 @@ Resources: - DELETE - HEAD AllowedOrigins: - - '*' + - "*" ExposedHeaders: - ETag - Date diff --git a/tests/e2e/README.md b/tests/e2e/README.md index 6b06fe5b1d..0341d64b12 100644 --- a/tests/e2e/README.md +++ b/tests/e2e/README.md @@ -18,16 +18,16 @@ Certain resources need to be created to make sure the integration test has backe 2. If you have `jq` [installed](https://jqlang.github.io/jq/), you can use the command below to export env variables for ressources that will be used during the E2E tests. - ```shell - $(aws cloudformation describe-stacks --stack-name LLRTReleaseIntegTestResourcesStack --query "Stacks[*].Outputs[*].{OutputKey: OutputKey, OutputValue: OutputValue}" | jq -r '.[0][] | "export \(.OutputKey|gsub("(?(?!^)|\b[a-zA-Z][a-z]*)(?[A-Z][a-z]*|\\d+)";"\(.x)_\(.y)")| ascii_upcase )=\(.OutputValue)"') - ``` + ```shell + $(aws cloudformation describe-stacks --stack-name LLRTReleaseIntegTestResourcesStack --query "Stacks[*].Outputs[*].{OutputKey: OutputKey, OutputValue: OutputValue}" | jq -r '.[0][] | "export \(.OutputKey|gsub("(?(?!^)|\b[a-zA-Z][a-z]*)(?[A-Z][a-z]*|\\d+)";"\(.x)_\(.y)")| ascii_upcase )=\(.OutputValue)"') + ``` If `jq` is not available, look at the CloudFormation `Outputs` and manually export the variables: - AWS_SMOKE_TEST_BUCKET - AWS_SMOKE_TEST_IDENTITY_POOL_ID - AWS_SMOKE_TEST_MRAP_ARN - + 3. Export your AWS credentials and Region: ```shell @@ -39,12 +39,13 @@ Certain resources need to be created to make sure the integration test has backe 4. Run the integration tests: This will build and run all integration tests + ```shell make test-ci ``` Assuming you already have a binary built for LLRT, this will run a specific integration tests (e.g.: `s3.e2e.test.ts`) + ```shell make bundle/%.js && target/debug/llrt test s3.e2e.test ``` - diff --git a/tests/e2e/cognito_identity.e2e.test.ts b/tests/e2e/cognito_identity.e2e.test.ts index 0681b45f06..9474de2a56 100644 --- a/tests/e2e/cognito_identity.e2e.test.ts +++ b/tests/e2e/cognito_identity.e2e.test.ts @@ -1,7 +1,7 @@ // From https://github.com/aws/aws-sdk-js-v3/blob/c8cb4499c6ad19e2b194860d548753f637671f8c/clients/client-cognito-identity/test/e2e/CognitoIdentity.ispec.ts#L6 import { expect } from "chai"; -import {CognitoIdentity} from "@aws-sdk/client-cognito-identity"; +import { CognitoIdentity } from "@aws-sdk/client-cognito-identity"; const IdentityPoolId = process?.env?.AWS_SMOKE_TEST_IDENTITY_POOL_ID; @@ -21,7 +21,11 @@ describe("@aws-sdk/client-cognito-identity", function () { IdentityId: getIdResult.IdentityId, }); expect(getCredentialsResult.$metadata.httpStatusCode).to.equal(200); - expect(typeof getCredentialsResult.Credentials?.AccessKeyId).to.equal("string"); - expect(typeof getCredentialsResult.Credentials?.SecretKey).to.equal("string"); + expect(typeof getCredentialsResult.Credentials?.AccessKeyId).to.equal( + "string" + ); + expect(typeof getCredentialsResult.Credentials?.SecretKey).to.equal( + "string" + ); }); }); diff --git a/tests/e2e/dynamodb.e2e.test.ts b/tests/e2e/dynamodb.e2e.test.ts index 86db84018e..e70f6b87c6 100644 --- a/tests/e2e/dynamodb.e2e.test.ts +++ b/tests/e2e/dynamodb.e2e.test.ts @@ -71,7 +71,8 @@ describe(DynamoDBDocument.name, () => { executeStatement: {} as Record, executeStatementReadBack: {} as Record, batchExecuteStatement: null as null | BatchExecuteStatementCommandOutput, - batchExecuteStatementReadBack: null as null | BatchExecuteStatementCommandOutput, + batchExecuteStatementReadBack: + null as null | BatchExecuteStatementCommandOutput, query: null as null | QueryCommandOutput, scan: null as null | ScanCommandOutput, update: {} as Record, @@ -426,7 +427,13 @@ describe(DynamoDBDocument.name, () => { .catch(passError); log.delete[id] = await (async () => { - for (const suffix of ["-batch", "-transact", "-exec-transact", "-statement", "-batch-statement"]) { + for (const suffix of [ + "-batch", + "-transact", + "-exec-transact", + "-statement", + "-batch-statement", + ]) { doc .delete({ TableName, @@ -442,13 +449,13 @@ describe(DynamoDBDocument.name, () => { }); })().catch(passError); } - },60000); + }, 60000); afterAll(async () => { await dynamodb.deleteTable({ TableName, }); - },30000); + }, 30000); describe("updateTransformFunction", () => { it("modifies all fields of an object", () => { @@ -551,7 +558,9 @@ describe(DynamoDBDocument.name, () => { for (const result of results) { // @ts-ignore - expect(result.Item?.data).toEqual(data[result.Item?.id.replace("-transact", "")]); + expect(result.Item?.data).toEqual( + data[result.Item?.id.replace("-transact", "")] + ); } }); @@ -563,10 +572,14 @@ describe(DynamoDBDocument.name, () => { throwIfError(log.batchExecuteStatement); expect(log.batchExecuteStatementReadBack?.Responses).toBeInstanceOf(Array); - expect(log.batchExecuteStatementReadBack?.Responses?.length).toBeGreaterThan(0); + expect( + log.batchExecuteStatementReadBack?.Responses?.length + ).toBeGreaterThan(0); for (const response of log.batchExecuteStatementReadBack?.Responses ?? []) { // @ts-ignore - expect(response.Item?.data).toEqual(data[response.Item?.id?.replace("-batch-statement", "")]); + expect(response.Item?.data).toEqual( + data[response.Item?.id?.replace("-batch-statement", "")] + ); } }); diff --git a/tests/e2e/s3.e2e.test.ts b/tests/e2e/s3.e2e.test.ts index 1981cd568e..7fa075516d 100644 --- a/tests/e2e/s3.e2e.test.ts +++ b/tests/e2e/s3.e2e.test.ts @@ -1,277 +1,284 @@ // From https://github.com/aws/aws-sdk-js-v3/blob/89f97b5cea8052510471cdad69acced9f5be60d1/clients/client-s3/test/e2e/S3.e2e.spec.ts#L15 -import {S3, SelectObjectContentEventStream} from "@aws-sdk/client-s3"; +import { S3, SelectObjectContentEventStream } from "@aws-sdk/client-s3"; const Bucket = process?.env?.AWS_SMOKE_TEST_BUCKET; const mrapArn = process?.env?.AWS_SMOKE_TEST_MRAP_ARN; let Key = `${Date.now()}`; describe("@aws-sdk/client-s3", () => { - const client = new S3(); + const client = new S3(); - // TODO Stream is not yet supported - describe.skip("PutObject", () => { - beforeAll(() => { - Key = `${Date.now()}`; - }); - afterAll(async () => { - await client.deleteObject({ Bucket, Key }); - }); - it("should succeed with Node.js readable stream body", async () => { - const length = 10 * 1000; // 10KB - const chunkSize = 10; - const { Readable } = require("stream"); - let sizeLeft = length; - const inputStream = new Readable({ - read() { - if (sizeLeft <= 0) { - this.push(null); //end stream; - return; - } - let chunk = ""; - for (let i = 0; i < Math.min(sizeLeft, chunkSize); i++) { - chunk += "x"; - } - this.push(chunk); - sizeLeft -= chunk.length; - }, - }); - inputStream.size = length; // This is required - const result = await client.putObject({ - Bucket, - Key, - Body: inputStream, - }); - expect(result.$metadata.httpStatusCode).toEqual(200); - }); + // TODO Stream is not yet supported + describe.skip("PutObject", () => { + beforeAll(() => { + Key = `${Date.now()}`; + }); + afterAll(async () => { + await client.deleteObject({ Bucket, Key }); + }); + it("should succeed with Node.js readable stream body", async () => { + const length = 10 * 1000; // 10KB + const chunkSize = 10; + const { Readable } = require("stream"); + let sizeLeft = length; + const inputStream = new Readable({ + read() { + if (sizeLeft <= 0) { + this.push(null); //end stream; + return; + } + let chunk = ""; + for (let i = 0; i < Math.min(sizeLeft, chunkSize); i++) { + chunk += "x"; + } + this.push(chunk); + sizeLeft -= chunk.length; + }, + }); + inputStream.size = length; // This is required + const result = await client.putObject({ + Bucket, + Key, + Body: inputStream, + }); + expect(result.$metadata.httpStatusCode).toEqual(200); }); + }); - describe("GetObject", function () { - beforeAll(async () => { - Key = `${Date.now()}`; - }); + describe("GetObject", function () { + beforeAll(async () => { + Key = `${Date.now()}`; + }); - afterAll(async () => { - await client.deleteObject({ Bucket, Key }); - }); + afterAll(async () => { + await client.deleteObject({ Bucket, Key }); + }); - it("should succeed with valid body payload", async () => { - // prepare the object. - const body = createBuffer("1MB"); + it("should succeed with valid body payload", async () => { + // prepare the object. + const body = createBuffer("1MB"); - try { - await client.putObject({ Bucket, Key, Body: body }); - } catch (e) { - console.error("failed to put"); - throw e; - } + try { + await client.putObject({ Bucket, Key, Body: body }); + } catch (e) { + console.error("failed to put"); + throw e; + } - try { - // eslint-disable-next-line no-var - var result = await client.getObject({ Bucket, Key }); - } catch (e) { - console.error("failed to get"); - throw e; - } + try { + // eslint-disable-next-line no-var + var result = await client.getObject({ Bucket, Key }); + } catch (e) { + console.error("failed to get"); + throw e; + } - let actual = result.$metadata.httpStatusCode; - expect(actual).toEqual(200); - }); + let actual = result.$metadata.httpStatusCode; + expect(actual).toEqual(200); }); + }); - // TODO FB Open a bug - describe("ListObjects", () => { - beforeAll(async () => { - Key = `${Date.now()}`; - await client.putObject({ Bucket, Key, Body: "foo" }); - }); - afterAll(async () => { - await client.deleteObject({ Bucket, Key }); - }); - it("should succeed with valid bucket", async () => { - const result = await client.listObjects({ - Bucket, - }); - expect(result.$metadata.httpStatusCode).toEqual(200); - expect(result.Contents instanceof Array).toEqual(true); - }); + // TODO FB Open a bug + describe("ListObjects", () => { + beforeAll(async () => { + Key = `${Date.now()}`; + await client.putObject({ Bucket, Key, Body: "foo" }); + }); + afterAll(async () => { + await client.deleteObject({ Bucket, Key }); + }); + it("should succeed with valid bucket", async () => { + const result = await client.listObjects({ + Bucket, + }); + expect(result.$metadata.httpStatusCode).toEqual(200); + expect(result.Contents instanceof Array).toEqual(true); + }); - it("should throw with invalid bucket", async () => { - try { - await client.listObjects({Bucket: "invalid-bucket"}); - assert(false, "Should throw an exception") - } catch (ignored) { - console.log("Exception should be thrown") - } - }); + it("should throw with invalid bucket", async () => { + try { + await client.listObjects({ Bucket: "invalid-bucket" }); + assert(false, "Should throw an exception"); + } catch (ignored) { + console.log("Exception should be thrown"); + } }); + }); - describe("MultipartUpload", () => { - let UploadId: string; - let Etag: string; - const multipartObjectKey = `${Key}-multipart`; - beforeAll(() => { - Key = `${Date.now()}`; - }); - afterEach(async () => { - if (UploadId) { - await client.abortMultipartUpload({ - Bucket, - Key: multipartObjectKey, - UploadId, - }); - } - await client.deleteObject({ - Bucket, - Key: multipartObjectKey, - }); + describe("MultipartUpload", () => { + let UploadId: string; + let Etag: string; + const multipartObjectKey = `${Key}-multipart`; + beforeAll(() => { + Key = `${Date.now()}`; + }); + afterEach(async () => { + if (UploadId) { + await client.abortMultipartUpload({ + Bucket, + Key: multipartObjectKey, + UploadId, }); + } + await client.deleteObject({ + Bucket, + Key: multipartObjectKey, + }); + }); - it("should successfully create, upload list and complete", async () => { - //create multipart upload - const createResult = await client.createMultipartUpload({ - Bucket, - Key: multipartObjectKey, - }); - expect(createResult.$metadata.httpStatusCode).toEqual(200); - expect(typeof createResult.UploadId).toEqual("string"); - UploadId = createResult.UploadId as string; - - //upload part - const uploadResult = await client.uploadPart({ - Bucket, - Key: multipartObjectKey, - UploadId, - PartNumber: 1, - Body: createBuffer("1KB"), - }); - expect(uploadResult.$metadata.httpStatusCode).toEqual(200); - expect(typeof uploadResult.ETag).toEqual("string"); - Etag = uploadResult.ETag as string; + it("should successfully create, upload list and complete", async () => { + //create multipart upload + const createResult = await client.createMultipartUpload({ + Bucket, + Key: multipartObjectKey, + }); + expect(createResult.$metadata.httpStatusCode).toEqual(200); + expect(typeof createResult.UploadId).toEqual("string"); + UploadId = createResult.UploadId as string; - //list parts - const listPartsResult = await client.listParts({ - Bucket, - Key: multipartObjectKey, - UploadId, - }); - expect(listPartsResult.$metadata.httpStatusCode).toEqual(200); - expect(listPartsResult.Parts?.length).toEqual(1); - expect(listPartsResult.Parts?.[0].ETag).toEqual(Etag); + //upload part + const uploadResult = await client.uploadPart({ + Bucket, + Key: multipartObjectKey, + UploadId, + PartNumber: 1, + Body: createBuffer("1KB"), + }); + expect(uploadResult.$metadata.httpStatusCode).toEqual(200); + expect(typeof uploadResult.ETag).toEqual("string"); + Etag = uploadResult.ETag as string; - //complete multipart upload // TODO FB bug here - const completeResult = await client.completeMultipartUpload({ - Bucket, - Key: multipartObjectKey, - UploadId, - MultipartUpload: { Parts: [{ ETag: Etag, PartNumber: 1 }] }, - }); - expect(completeResult.$metadata.httpStatusCode).toEqual(200); + //list parts + const listPartsResult = await client.listParts({ + Bucket, + Key: multipartObjectKey, + UploadId, + }); + expect(listPartsResult.$metadata.httpStatusCode).toEqual(200); + expect(listPartsResult.Parts?.length).toEqual(1); + expect(listPartsResult.Parts?.[0].ETag).toEqual(Etag); + //complete multipart upload // TODO FB bug here + const completeResult = await client.completeMultipartUpload({ + Bucket, + Key: multipartObjectKey, + UploadId, + MultipartUpload: { Parts: [{ ETag: Etag, PartNumber: 1 }] }, + }); + expect(completeResult.$metadata.httpStatusCode).toEqual(200); - //validate the object is uploaded - const headResult = await client.headObject({ - Bucket, - Key: multipartObjectKey, - }); - expect(headResult.$metadata.httpStatusCode).toEqual(200); - }); + //validate the object is uploaded + const headResult = await client.headObject({ + Bucket, + Key: multipartObjectKey, + }); + expect(headResult.$metadata.httpStatusCode).toEqual(200); + }); - it("should successfully create, abort, and list upload", async () => { - //create multipart upload - const createResult = await client.createMultipartUpload({ - Bucket, - Key: multipartObjectKey, - }); - expect(createResult.$metadata.httpStatusCode).toEqual(200); - const toAbort = createResult.UploadId; - expect(typeof toAbort).toEqual("string"); + it("should successfully create, abort, and list upload", async () => { + //create multipart upload + const createResult = await client.createMultipartUpload({ + Bucket, + Key: multipartObjectKey, + }); + expect(createResult.$metadata.httpStatusCode).toEqual(200); + const toAbort = createResult.UploadId; + expect(typeof toAbort).toEqual("string"); - //abort multipart upload - const abortResult = await client.abortMultipartUpload({ - Bucket, - Key: multipartObjectKey, - UploadId: toAbort, - }); - expect(abortResult.$metadata.httpStatusCode).toEqual(204); + //abort multipart upload + const abortResult = await client.abortMultipartUpload({ + Bucket, + Key: multipartObjectKey, + UploadId: toAbort, + }); + expect(abortResult.$metadata.httpStatusCode).toEqual(204); - //validate multipart upload is aborted // TODO FB bug here - const listUploadsResult = await client.listMultipartUploads({ - Bucket, - }); - expect(listUploadsResult.$metadata.httpStatusCode).toEqual(200); - expect((listUploadsResult.Uploads || []).map((upload) => upload.UploadId)).not.toContain(toAbort); - }); + //validate multipart upload is aborted // TODO FB bug here + const listUploadsResult = await client.listMultipartUploads({ + Bucket, + }); + expect(listUploadsResult.$metadata.httpStatusCode).toEqual(200); + expect( + (listUploadsResult.Uploads || []).map((upload) => upload.UploadId) + ).not.toContain(toAbort); }); + }); - // TODO Stream is not yet supported - describe.skip("selectObjectContent", () => { - const csvFile = `user_name,age + // TODO Stream is not yet supported + describe.skip("selectObjectContent", () => { + const csvFile = `user_name,age jsrocks,13 node4life,22 esfuture,29`; - beforeAll(async () => { - Key = `${Date.now()}`; - await client.putObject({ Bucket, Key, Body: csvFile }); - }); - afterAll(async () => { - await client.deleteObject({ Bucket, Key }); - }); - it("should succeed", async () => { - const { Payload } = await client.selectObjectContent({ - Bucket, - Key, - ExpressionType: "SQL", - Expression: "SELECT user_name FROM S3Object WHERE cast(age as int) > 20", - InputSerialization: { - CSV: { - FileHeaderInfo: "USE", - RecordDelimiter: "\n", - FieldDelimiter: ",", - }, - }, - OutputSerialization: { - CSV: {}, - }, - }); + beforeAll(async () => { + Key = `${Date.now()}`; + await client.putObject({ Bucket, Key, Body: csvFile }); + }); + afterAll(async () => { + await client.deleteObject({ Bucket, Key }); + }); + it("should succeed", async () => { + const { Payload } = await client.selectObjectContent({ + Bucket, + Key, + ExpressionType: "SQL", + Expression: + "SELECT user_name FROM S3Object WHERE cast(age as int) > 20", + InputSerialization: { + CSV: { + FileHeaderInfo: "USE", + RecordDelimiter: "\n", + FieldDelimiter: ",", + }, + }, + OutputSerialization: { + CSV: {}, + }, + }); - const events: SelectObjectContentEventStream[] = []; - for await (const event of Payload!) { - events.push(event); - } - expect(events.length).toEqual(3); - expect(new TextDecoder().decode(events[0].Records?.Payload)).toEqual("node4life\nesfuture\n"); - // expect(events[1].Stats?.Details).toBeDefined(); - // expect(events[2].End).toBeDefined(); - }); + const events: SelectObjectContentEventStream[] = []; + for await (const event of Payload!) { + events.push(event); + } + expect(events.length).toEqual(3); + expect(new TextDecoder().decode(events[0].Records?.Payload)).toEqual( + "node4life\nesfuture\n" + ); + // expect(events[1].Stats?.Details).toBeDefined(); + // expect(events[2].End).toBeDefined(); }); + }); - describe.skip("Multi-region access point", () => { // TODO FB - beforeAll(async () => { - Key = `${Date.now()}`; - await client.putObject({ Bucket: mrapArn, Key, Body: "foo" }); - }); - afterAll(async () => { - await client.deleteObject({ Bucket: mrapArn, Key }); - }); - it("should succeed with valid MRAP ARN", async () => { - const result = await client.listObjects({ - Bucket: mrapArn, - }); - expect(result.$metadata.httpStatusCode).toEqual(200); - expect(result.Contents instanceof Array).toEqual(true); - }); + describe.skip("Multi-region access point", () => { + // TODO FB + beforeAll(async () => { + Key = `${Date.now()}`; + await client.putObject({ Bucket: mrapArn, Key, Body: "foo" }); + }); + afterAll(async () => { + await client.deleteObject({ Bucket: mrapArn, Key }); + }); + it("should succeed with valid MRAP ARN", async () => { + const result = await client.listObjects({ + Bucket: mrapArn, + }); + expect(result.$metadata.httpStatusCode).toEqual(200); + expect(result.Contents instanceof Array).toEqual(true); }); + }); }); export const createBuffer = (size: string) => { - const KB_REGEX = /(\d+)KB/; - const MB_REGEX = /(\d+)MB/; - if (KB_REGEX.test(size)) { - return new Uint8Array(parseInt(size.match(KB_REGEX)![1]) * 1024).fill(0x78); - } else if (MB_REGEX.test(size)) { - return new Uint8Array(parseInt(size.match(MB_REGEX)![1]) * 1024 * 1024).fill(0x78); - } else { - return new Uint8Array(1024 * 1024).fill(0x78); - } + const KB_REGEX = /(\d+)KB/; + const MB_REGEX = /(\d+)MB/; + if (KB_REGEX.test(size)) { + return new Uint8Array(parseInt(size.match(KB_REGEX)![1]) * 1024).fill(0x78); + } else if (MB_REGEX.test(size)) { + return new Uint8Array( + parseInt(size.match(MB_REGEX)![1]) * 1024 * 1024 + ).fill(0x78); + } else { + return new Uint8Array(1024 * 1024).fill(0x78); + } }; diff --git a/tests/unit/fs.test.ts b/tests/unit/fs.test.ts index ea3c08a1c0..798edc1663 100644 --- a/tests/unit/fs.test.ts +++ b/tests/unit/fs.test.ts @@ -26,10 +26,13 @@ describe("readdir", () => { assert.deepEqual(dir, ["config.toml"]); }); - it('should read a directory with recursive', async () => { - const dir = await fs.readdir('fixtures/fs/readdir', { recursive: true }); - const compare = (a: string, b: string) => a >= b ? 1 : -1; - assert.deepEqual(dir.sort(compare), ['recursive/readdir.js', 'recursive', 'readdir.js'].sort(compare)); + it("should read a directory with recursive", async () => { + const dir = await fs.readdir("fixtures/fs/readdir", { recursive: true }); + const compare = (a: string, b: string) => (a >= b ? 1 : -1); + assert.deepEqual( + dir.sort(compare), + ["recursive/readdir.js", "recursive", "readdir.js"].sort(compare) + ); }); }); @@ -40,8 +43,8 @@ describe("readdirSync", () => { }); it("should read a directory with types synchronously", () => { - const dir = defaultFsImport.readdirSync(".cargo", {withFileTypes: true}); - assert.deepEqual(dir, [{name: "config.toml"}]); + const dir = defaultFsImport.readdirSync(".cargo", { withFileTypes: true }); + assert.deepEqual(dir, [{ name: "config.toml" }]); assert.equal(dir[0].isFile(), true); }); @@ -55,10 +58,16 @@ describe("readdirSync", () => { assert.deepEqual(dir, ["config.toml"]); }); - it('should read a directory with recursive synchronously', () => { - const dir = defaultFsImport.readdirSync('fixtures/fs/readdir', {recursive: true}); - const compare = (a: string | Buffer, b: string | Buffer): number => a >= b ? 1 : -1; - assert.deepEqual(dir.sort(compare), ['recursive/readdir.js', 'recursive', 'readdir.js'].sort(compare)); + it("should read a directory with recursive synchronously", () => { + const dir = defaultFsImport.readdirSync("fixtures/fs/readdir", { + recursive: true, + }); + const compare = (a: string | Buffer, b: string | Buffer): number => + a >= b ? 1 : -1; + assert.deepEqual( + dir.sort(compare), + ["recursive/readdir.js", "recursive", "readdir.js"].sort(compare) + ); }); }); @@ -104,7 +113,9 @@ describe("mkdir", () => { const dirPath = await fs.mkdtemp(path.join(os.tmpdir(), "test/test-")); //non recursive should reject - expect(fs.mkdir(dirPath)).rejects.toThrow("EEXIST: file already exists, mkdir"); + expect(fs.mkdir(dirPath)).rejects.toThrow( + "EEXIST: file already exists, mkdir" + ); await fs.mkdir(dirPath, { recursive: true }); @@ -125,7 +136,7 @@ describe("mkdirSync", () => { const dirPath = await fs.mkdtemp(path.join(os.tmpdir(), "test/test-")); //non recursive should reject - expect(()=>defaultFsImport.mkdirSync(dirPath)).toThrow(/[fF]ile.*exists/); + expect(() => defaultFsImport.mkdirSync(dirPath)).toThrow(/[fF]ile.*exists/); defaultFsImport.mkdirSync(dirPath, { recursive: true }); @@ -191,11 +202,15 @@ describe("accessSync", () => { it("should throw if not proper permissions synchronously", () => { const filePath = "fixtures/hello.txt"; - expect(()=>defaultFsImport.accessSync(filePath, fs.constants.X_OK)).toThrow(/[pP]ermission denied/); + expect(() => + defaultFsImport.accessSync(filePath, fs.constants.X_OK) + ).toThrow(/[pP]ermission denied/); }); it("should throw if not exists synchronously", () => { const filePath = "fixtures/nothing"; - expect(()=>defaultFsImport.accessSync(filePath)).toThrow(/[Nn]o such file or directory/); + expect(() => defaultFsImport.accessSync(filePath)).toThrow( + /[Nn]o such file or directory/ + ); }); }); diff --git a/tests/unit/jest-expect.test.ts b/tests/unit/jest-expect.test.ts index 74941bcad6..1b33cd8f23 100644 --- a/tests/unit/jest-expect.test.ts +++ b/tests/unit/jest-expect.test.ts @@ -27,233 +27,257 @@ SOFTWARE. class TestError extends Error {} -describe('jest-expect', () => { - it('basic', () => { - expect(1).toBe(1) - expect(null).toBeNull() - expect(1).not.toBeNull() - expect(null).toBeDefined() - expect(undefined).not.toBeDefined() - expect(undefined).toBeUndefined() - expect(null).not.toBeUndefined() - expect([]).toBeTruthy() - expect(0).toBeFalsy() - expect('Hello').toMatch(/llo/) - expect('Hello').toMatch('llo') - expect('Hello').toContain('llo') - expect(['Hello']).toContain('Hello') - expect([{ text: 'Hello' }]).toContainEqual({ text: 'Hello' }) - expect([{ text: 'Bye' }]).not.toContainEqual({ text: 'Hello' }) - expect(1).toBeGreaterThan(0) - - expect(new Date(0)).toEqual(new Date(0)) - expect(new Date('inValId')).toEqual(new Date('inValId')) - - expect(new Error('message')).toEqual(new Error('message')) - expect(new Error('message')).not.toEqual(new Error('different message')) - - expect(new URL('https://example.org')).toEqual(new URL('https://example.org')) - expect(new URL('https://example.org')).not.toEqual(new URL('https://different-example.org')) - expect(new URL('https://example.org?query=value')).toEqual(new URL('https://example.org?query=value')) - expect(new URL('https://example.org?query=one')).not.toEqual(new URL('https://example.org?query=two')) - expect(new URL('https://subdomain.example.org/path?query=value#fragment-identifier')).toEqual(new URL('https://subdomain.example.org/path?query=value#fragment-identifier')) - expect(new URL('https://subdomain.example.org/path?query=value#fragment-identifier')).not.toEqual(new URL('https://subdomain.example.org/path?query=value#different-fragment-identifier')) - expect(new URL('https://example.org/path')).toEqual(new URL('/path', 'https://example.org')) - expect(new URL('https://example.org/path')).not.toEqual(new URL('/path', 'https://example.com')) - - expect(BigInt(1)).toBeGreaterThan(BigInt(0)) - expect(1).toBeGreaterThan(BigInt(0)) - expect(BigInt(1)).toBeGreaterThan(0) - - expect(1).toBeGreaterThanOrEqual(1) - expect(1).toBeGreaterThanOrEqual(0) - - expect(BigInt(1)).toBeGreaterThanOrEqual(BigInt(1)) - expect(BigInt(1)).toBeGreaterThanOrEqual(BigInt(0)) - expect(BigInt(1)).toBeGreaterThanOrEqual(1) - expect(1).toBeGreaterThanOrEqual(BigInt(1)) - - expect(0).toBeLessThan(1) - expect(BigInt(0)).toBeLessThan(BigInt(1)) - expect(BigInt(0)).toBeLessThan(1) - - expect(1).toBeLessThanOrEqual(1) - expect(0).toBeLessThanOrEqual(1) - expect(BigInt(1)).toBeLessThanOrEqual(BigInt(1)) - expect(BigInt(0)).toBeLessThanOrEqual(BigInt(1)) - expect(BigInt(1)).toBeLessThanOrEqual(1) - expect(1).toBeLessThanOrEqual(BigInt(1)) +describe("jest-expect", () => { + it("basic", () => { + expect(1).toBe(1); + expect(null).toBeNull(); + expect(1).not.toBeNull(); + expect(null).toBeDefined(); + expect(undefined).not.toBeDefined(); + expect(undefined).toBeUndefined(); + expect(null).not.toBeUndefined(); + expect([]).toBeTruthy(); + expect(0).toBeFalsy(); + expect("Hello").toMatch(/llo/); + expect("Hello").toMatch("llo"); + expect("Hello").toContain("llo"); + expect(["Hello"]).toContain("Hello"); + expect([{ text: "Hello" }]).toContainEqual({ text: "Hello" }); + expect([{ text: "Bye" }]).not.toContainEqual({ text: "Hello" }); + expect(1).toBeGreaterThan(0); + + expect(new Date(0)).toEqual(new Date(0)); + expect(new Date("inValId")).toEqual(new Date("inValId")); + + expect(new Error("message")).toEqual(new Error("message")); + expect(new Error("message")).not.toEqual(new Error("different message")); + + expect(new URL("https://example.org")).toEqual( + new URL("https://example.org") + ); + expect(new URL("https://example.org")).not.toEqual( + new URL("https://different-example.org") + ); + expect(new URL("https://example.org?query=value")).toEqual( + new URL("https://example.org?query=value") + ); + expect(new URL("https://example.org?query=one")).not.toEqual( + new URL("https://example.org?query=two") + ); + expect( + new URL( + "https://subdomain.example.org/path?query=value#fragment-identifier" + ) + ).toEqual( + new URL( + "https://subdomain.example.org/path?query=value#fragment-identifier" + ) + ); + expect( + new URL( + "https://subdomain.example.org/path?query=value#fragment-identifier" + ) + ).not.toEqual( + new URL( + "https://subdomain.example.org/path?query=value#different-fragment-identifier" + ) + ); + expect(new URL("https://example.org/path")).toEqual( + new URL("/path", "https://example.org") + ); + expect(new URL("https://example.org/path")).not.toEqual( + new URL("/path", "https://example.com") + ); + + expect(BigInt(1)).toBeGreaterThan(BigInt(0)); + expect(1).toBeGreaterThan(BigInt(0)); + expect(BigInt(1)).toBeGreaterThan(0); + + expect(1).toBeGreaterThanOrEqual(1); + expect(1).toBeGreaterThanOrEqual(0); + + expect(BigInt(1)).toBeGreaterThanOrEqual(BigInt(1)); + expect(BigInt(1)).toBeGreaterThanOrEqual(BigInt(0)); + expect(BigInt(1)).toBeGreaterThanOrEqual(1); + expect(1).toBeGreaterThanOrEqual(BigInt(1)); + + expect(0).toBeLessThan(1); + expect(BigInt(0)).toBeLessThan(BigInt(1)); + expect(BigInt(0)).toBeLessThan(1); + + expect(1).toBeLessThanOrEqual(1); + expect(0).toBeLessThanOrEqual(1); + expect(BigInt(1)).toBeLessThanOrEqual(BigInt(1)); + expect(BigInt(0)).toBeLessThanOrEqual(BigInt(1)); + expect(BigInt(1)).toBeLessThanOrEqual(1); + expect(1).toBeLessThanOrEqual(BigInt(1)); expect(() => { - throw new Error('this is the error message') - }).toThrow('this is the error message') - expect(() => {}).not.toThrow() + throw new Error("this is the error message"); + }).toThrow("this is the error message"); + expect(() => {}).not.toThrow(); expect(() => { - throw new TestError('error') - }).toThrow(TestError) - const err = new Error('hello world') + throw new TestError("error"); + }).toThrow(TestError); + const err = new Error("hello world"); expect(() => { - throw err - }).toThrow(err) + throw err; + }).toThrow(err); expect(() => { - throw new Error('message') - }).toThrow(expect.objectContaining({ - message: expect.stringContaining('mes'), - })) - expect([1, 2, 3]).toHaveLength(3) - expect('abc').toHaveLength(3) - expect('').not.toHaveLength(5) - expect({ length: 3 }).toHaveLength(3) - expect(0.2 + 0.1).not.toBe(0.3) - expect(0.2 + 0.1).toBeCloseTo(0.3, 5) - expect(0.2 + 0.1).not.toBeCloseTo(0.3, 100) // expect.closeTo will fail in chai - }) - - it('asymmetric matchers (jest style)', () => { - expect({ foo: 'bar' }).toEqual({ foo: expect.stringContaining('ba') }) - expect('bar').toEqual(expect.stringContaining('ba')) - expect(['bar']).toEqual([expect.stringContaining('ba')]) - expect(new Set(['bar'])).toEqual(new Set([expect.stringContaining('ba')])) - expect(new Set(['bar'])).not.toEqual(new Set([expect.stringContaining('zoo')])) - - expect({ foo: 'bar' }).not.toEqual({ foo: expect.stringContaining('zoo') }) - expect('bar').not.toEqual(expect.stringContaining('zoo')) - expect(['bar']).not.toEqual([expect.stringContaining('zoo')]) - - expect({ foo: 'bar', bar: 'foo', hi: 'hello' }).toEqual({ - foo: expect.stringContaining('ba'), - bar: expect.stringContaining('fo'), - hi: 'hello', - }) - expect(0).toEqual(expect.anything()) - expect({}).toEqual(expect.anything()) - expect('string').toEqual(expect.anything()) - expect(null).not.toEqual(expect.anything()) - expect(undefined).not.toEqual(expect.anything()) - expect({ a: 0, b: 0 }).toEqual(expect.objectContaining({ a: 0 })) - expect({ a: 0, b: 0 }).not.toEqual(expect.objectContaining({ z: 0 })) - expect(0).toEqual(expect.any(Number)) - expect('string').toEqual(expect.any(String)) - expect('string').not.toEqual(expect.any(Number)) - - expect(['Bob', 'Eve']).toEqual(expect.arrayContaining(['Bob'])) - expect(['Bob', 'Eve']).not.toEqual(expect.arrayContaining(['Mohammad'])) - - expect([ - { name: 'Bob' }, - { name: 'Eve' }, - ]).toEqual(expect.arrayContaining<{ name: string }>([ - { name: 'Bob' }, - ])) - expect([ - { name: 'Bob' }, - { name: 'Eve' }, - ]).not.toEqual(expect.arrayContaining<{ name: string }>([ - { name: 'Mohammad' }, - ])) - - expect('Mohammad').toEqual(expect.stringMatching(/Moh/)) - expect('Mohammad').not.toEqual(expect.stringMatching(/jack/)) + throw new Error("message"); + }).toThrow( + expect.objectContaining({ + message: expect.stringContaining("mes"), + }) + ); + expect([1, 2, 3]).toHaveLength(3); + expect("abc").toHaveLength(3); + expect("").not.toHaveLength(5); + expect({ length: 3 }).toHaveLength(3); + expect(0.2 + 0.1).not.toBe(0.3); + expect(0.2 + 0.1).toBeCloseTo(0.3, 5); + expect(0.2 + 0.1).not.toBeCloseTo(0.3, 100); // expect.closeTo will fail in chai + }); + + it("asymmetric matchers (jest style)", () => { + expect({ foo: "bar" }).toEqual({ foo: expect.stringContaining("ba") }); + expect("bar").toEqual(expect.stringContaining("ba")); + expect(["bar"]).toEqual([expect.stringContaining("ba")]); + expect(new Set(["bar"])).toEqual(new Set([expect.stringContaining("ba")])); + expect(new Set(["bar"])).not.toEqual( + new Set([expect.stringContaining("zoo")]) + ); + + expect({ foo: "bar" }).not.toEqual({ foo: expect.stringContaining("zoo") }); + expect("bar").not.toEqual(expect.stringContaining("zoo")); + expect(["bar"]).not.toEqual([expect.stringContaining("zoo")]); + + expect({ foo: "bar", bar: "foo", hi: "hello" }).toEqual({ + foo: expect.stringContaining("ba"), + bar: expect.stringContaining("fo"), + hi: "hello", + }); + expect(0).toEqual(expect.anything()); + expect({}).toEqual(expect.anything()); + expect("string").toEqual(expect.anything()); + expect(null).not.toEqual(expect.anything()); + expect(undefined).not.toEqual(expect.anything()); + expect({ a: 0, b: 0 }).toEqual(expect.objectContaining({ a: 0 })); + expect({ a: 0, b: 0 }).not.toEqual(expect.objectContaining({ z: 0 })); + expect(0).toEqual(expect.any(Number)); + expect("string").toEqual(expect.any(String)); + expect("string").not.toEqual(expect.any(Number)); + + expect(["Bob", "Eve"]).toEqual(expect.arrayContaining(["Bob"])); + expect(["Bob", "Eve"]).not.toEqual(expect.arrayContaining(["Mohammad"])); + + expect([{ name: "Bob" }, { name: "Eve" }]).toEqual( + expect.arrayContaining<{ name: string }>([{ name: "Bob" }]) + ); + expect([{ name: "Bob" }, { name: "Eve" }]).not.toEqual( + expect.arrayContaining<{ name: string }>([{ name: "Mohammad" }]) + ); + + expect("Mohammad").toEqual(expect.stringMatching(/Moh/)); + expect("Mohammad").not.toEqual(expect.stringMatching(/jack/)); expect({ sum: 0.1 + 0.2, }).toEqual({ sum: expect.closeTo(0.3, 5), - }) + }); expect({ sum: 0.1 + 0.2, }).not.toEqual({ sum: expect.closeTo(0.4, 5), - }) + }); expect({ sum: 0.1 + 0.2, }).toEqual({ // @ts-ignore sum: expect.not.closeTo(0.4, 5), - }) - - }) - - it('asymmetric matchers negate', () => { - expect('bar').toEqual(expect.not.stringContaining('zoo')) - expect('bar').toEqual(expect.not.stringMatching(/zoo/)) - expect({ bar: 'zoo' }).toEqual(expect.not.objectContaining({ zoo: 'bar' })) - expect(['Bob', 'Eve']).toEqual(expect.not.arrayContaining(['Steve'])) - }) - - it('object', () => { - expect({}).toEqual({}) - expect({ apples: 13 }).toEqual({ apples: 13 }) - expect({}).toStrictEqual({}) - expect({}).not.toBe({}) - - const foo = {} + }); + }); + + it("asymmetric matchers negate", () => { + expect("bar").toEqual(expect.not.stringContaining("zoo")); + expect("bar").toEqual(expect.not.stringMatching(/zoo/)); + expect({ bar: "zoo" }).toEqual(expect.not.objectContaining({ zoo: "bar" })); + expect(["Bob", "Eve"]).toEqual(expect.not.arrayContaining(["Steve"])); + }); + + it("object", () => { + expect({}).toEqual({}); + expect({ apples: 13 }).toEqual({ apples: 13 }); + expect({}).toStrictEqual({}); + expect({}).not.toBe({}); + + const foo = {}; const complex = { - '0': 'zero', - 'foo': 1, - 'foo.bar[0]': 'baz', - 'a-b': true, - 'a-b-1.0.0': true, - 'bar': { - foo: 'foo', + "0": "zero", + foo: 1, + "foo.bar[0]": "baz", + "a-b": true, + "a-b-1.0.0": true, + bar: { + foo: "foo", bar: 100, - arr: ['first', { zoo: 'monkey' }], + arr: ["first", { zoo: "monkey" }], }, - } - - expect(foo).toBe(foo) - expect(foo).toStrictEqual(foo) - expect(complex).toMatchObject({}) - expect(complex).toMatchObject({ foo: 1 }) - expect([complex]).toMatchObject([{ foo: 1 }]) - expect(complex).not.toMatchObject({ foo: 2 }) - expect(complex).toMatchObject({ bar: { bar: 100 } }) - expect(complex).toMatchObject({ foo: expect.any(Number) }) - - expect(complex).toHaveProperty('a-b') - expect(complex).toHaveProperty('a-b-1.0.0') - expect(complex).toHaveProperty('0') - expect(complex).toHaveProperty('0', 'zero') - expect(complex).toHaveProperty(['0']) - expect(complex).toHaveProperty(['0'], 'zero') - expect(complex).toHaveProperty([0]) - expect(complex).toHaveProperty([0], 'zero') - expect(complex).toHaveProperty('foo') - expect(complex).toHaveProperty('foo', 1) - expect(complex).toHaveProperty('bar.foo', 'foo') - expect(complex).toHaveProperty('bar.arr[0]') - expect(complex).toHaveProperty('bar.arr[1].zoo', 'monkey') - expect(complex).toHaveProperty('bar.arr.0') - expect(complex).toHaveProperty(['bar', 'arr', '0']) - expect(complex).toHaveProperty(['bar', 'arr', '0'], 'first') - expect(complex).toHaveProperty(['bar', 'arr', 0]) - expect(complex).toHaveProperty(['bar', 'arr', 0], 'first') - expect(complex).toHaveProperty('bar.arr.1.zoo', 'monkey') - expect(complex).toHaveProperty(['bar', 'arr', '1', 'zoo'], 'monkey') - expect(complex).toHaveProperty(['foo.bar[0]'], 'baz') - - expect(complex).toHaveProperty('foo', expect.any(Number)) - expect(complex).toHaveProperty('bar', expect.any(Object)) - expect(complex).toHaveProperty('bar.arr', expect.any(Array)) - expect(complex).toHaveProperty('bar.arr.0', expect.anything()) + }; + + expect(foo).toBe(foo); + expect(foo).toStrictEqual(foo); + expect(complex).toMatchObject({}); + expect(complex).toMatchObject({ foo: 1 }); + expect([complex]).toMatchObject([{ foo: 1 }]); + expect(complex).not.toMatchObject({ foo: 2 }); + expect(complex).toMatchObject({ bar: { bar: 100 } }); + expect(complex).toMatchObject({ foo: expect.any(Number) }); + + expect(complex).toHaveProperty("a-b"); + expect(complex).toHaveProperty("a-b-1.0.0"); + expect(complex).toHaveProperty("0"); + expect(complex).toHaveProperty("0", "zero"); + expect(complex).toHaveProperty(["0"]); + expect(complex).toHaveProperty(["0"], "zero"); + expect(complex).toHaveProperty([0]); + expect(complex).toHaveProperty([0], "zero"); + expect(complex).toHaveProperty("foo"); + expect(complex).toHaveProperty("foo", 1); + expect(complex).toHaveProperty("bar.foo", "foo"); + expect(complex).toHaveProperty("bar.arr[0]"); + expect(complex).toHaveProperty("bar.arr[1].zoo", "monkey"); + expect(complex).toHaveProperty("bar.arr.0"); + expect(complex).toHaveProperty(["bar", "arr", "0"]); + expect(complex).toHaveProperty(["bar", "arr", "0"], "first"); + expect(complex).toHaveProperty(["bar", "arr", 0]); + expect(complex).toHaveProperty(["bar", "arr", 0], "first"); + expect(complex).toHaveProperty("bar.arr.1.zoo", "monkey"); + expect(complex).toHaveProperty(["bar", "arr", "1", "zoo"], "monkey"); + expect(complex).toHaveProperty(["foo.bar[0]"], "baz"); + + expect(complex).toHaveProperty("foo", expect.any(Number)); + expect(complex).toHaveProperty("bar", expect.any(Object)); + expect(complex).toHaveProperty("bar.arr", expect.any(Array)); + expect(complex).toHaveProperty("bar.arr.0", expect.anything()); expect(() => { - expect(complex).toHaveProperty('some-unknown-property') - }).toThrowError() + expect(complex).toHaveProperty("some-unknown-property"); + }).toThrowError(); expect(() => { - expect(complex).toHaveProperty('a-b', false) - }).toThrowError() + expect(complex).toHaveProperty("a-b", false); + }).toThrowError(); expect(() => { - const x = { a: { b: { c: 1 } } } - const y = { a: { b: { c: 2 } } } - Object.freeze(x.a) - expect(x).toEqual(y) - }).toThrowError() - }) - + const x = { a: { b: { c: 1 } } }; + const y = { a: { b: { c: 2 } } }; + Object.freeze(x.a); + expect(x).toEqual(y); + }).toThrowError(); + }); // https://jestjs.io/docs/expect#tostrictequalvalue @@ -261,215 +285,217 @@ describe('jest-expect', () => { constructor(public flavor: any) {} } - describe('the La Croix cans on my desk', () => { - it('are not semantically the same', () => { - expect(new LaCroix('lemon')).toEqual({ flavor: 'lemon' }) - expect(new LaCroix('lemon')).not.toStrictEqual({ flavor: 'lemon' }) - }) - }) + describe("the La Croix cans on my desk", () => { + it("are not semantically the same", () => { + expect(new LaCroix("lemon")).toEqual({ flavor: "lemon" }); + expect(new LaCroix("lemon")).not.toStrictEqual({ flavor: "lemon" }); + }); + }); - it('array', () => { - expect([]).toEqual([]) - expect([]).not.toBe([]) - expect([]).toStrictEqual([]) + it("array", () => { + expect([]).toEqual([]); + expect([]).not.toBe([]); + expect([]).toStrictEqual([]); - const foo: any[] = [] + const foo: any[] = []; - expect(foo).toBe(foo) - expect(foo).toStrictEqual(foo) + expect(foo).toBe(foo); + expect(foo).toStrictEqual(foo); const complex = [ { foo: 1, - bar: { foo: 'foo', bar: 100, arr: ['first', { zoo: 'monkey' }] }, + bar: { foo: "foo", bar: 100, arr: ["first", { zoo: "monkey" }] }, }, - ] + ]; expect(complex).toStrictEqual([ { foo: 1, - bar: { foo: 'foo', bar: 100, arr: ['first', { zoo: 'monkey' }] }, + bar: { foo: "foo", bar: 100, arr: ["first", { zoo: "monkey" }] }, }, - ]) - }) + ]); + }); - describe('toThrow', () => { - it('error wasn\'t thrown', () => { + describe("toThrow", () => { + it("error wasn't thrown", () => { expect(() => { - expect(() => { - }).toThrow(Error) - }).toThrow() - }) + expect(() => {}).toThrow(Error); + }).toThrow(); + }); - it('async wasn\'t awaited', () => { + it("async wasn't awaited", () => { expect(() => { - expect(async () => { - }).toThrow(Error) - }).toThrow() - }) - }) -}) - -describe('.toStrictEqual()', () => { + expect(async () => {}).toThrow(Error); + }).toThrow(); + }); + }); +}); + +describe(".toStrictEqual()", () => { class TestClassA { - constructor(public a: any, public b: any) {} + constructor( + public a: any, + public b: any + ) {} } class TestClassB { - constructor(public a: any, public b: any) {} + constructor( + public a: any, + public b: any + ) {} } const TestClassC = class Child extends TestClassA { constructor(a: any, b: any) { - super(a, b) + super(a, b); } - } + }; const TestClassD = class Child extends TestClassB { constructor(a: any, b: any) { - super(a, b) + super(a, b); } - } + }; - it('does not ignore keys with undefined values', () => { + it("does not ignore keys with undefined values", () => { expect({ a: undefined, b: 2, - }).not.toStrictEqual({ b: 2 }) - }) + }).not.toStrictEqual({ b: 2 }); + }); - it('does not ignore keys with undefined values inside an array', () => { - expect([{ a: undefined }]).not.toStrictEqual([{}]) - }) + it("does not ignore keys with undefined values inside an array", () => { + expect([{ a: undefined }]).not.toStrictEqual([{}]); + }); - it('does not ignore keys with undefined values deep inside an object', () => { - expect([{ a: [{ a: undefined }] }]).not.toStrictEqual([{ a: [{}] }]) - }) + it("does not ignore keys with undefined values deep inside an object", () => { + expect([{ a: [{ a: undefined }] }]).not.toStrictEqual([{ a: [{}] }]); + }); - it('does not consider holes as undefined in sparse arrays', () => { - expect([, , , 1, , ,]).not.toStrictEqual([, , , 1, undefined, ,]) - }) + it("does not consider holes as undefined in sparse arrays", () => { + expect([, , , 1, , ,]).not.toStrictEqual([, , , 1, undefined, ,]); + }); - it('passes when comparing same type', () => { + it("passes when comparing same type", () => { expect({ test: new TestClassA(1, 2), - }).toStrictEqual({ test: new TestClassA(1, 2) }) - }) + }).toStrictEqual({ test: new TestClassA(1, 2) }); + }); - it('does not pass for different types', () => { + it("does not pass for different types", () => { expect({ test: new TestClassA(1, 2), - }).not.toStrictEqual({ test: new TestClassB(1, 2) }) - }) - - it('does not simply compare constructor names', () => { - const c = new TestClassC(1, 2) - const d = new TestClassD(1, 2) - expect(c.constructor.name).toEqual(d.constructor.name) - expect({ test: c }).not.toStrictEqual({ test: d }) - }) - - it('passes for matching sparse arrays', () => { - expect([, 1]).toStrictEqual([, 1]) - }) - - it('does not pass when sparseness of arrays do not match', () => { - expect([, 1]).not.toStrictEqual([undefined, 1]) - expect([undefined, 1]).not.toStrictEqual([, 1]) - expect([, , , 1]).not.toStrictEqual([, 1]) - }) - - it('does not pass when equally sparse arrays have different values', () => { - expect([, 1]).not.toStrictEqual([, 2]) - }) - - it('does not pass when ArrayBuffers are not equal', () => { + }).not.toStrictEqual({ test: new TestClassB(1, 2) }); + }); + + it("does not simply compare constructor names", () => { + const c = new TestClassC(1, 2); + const d = new TestClassD(1, 2); + expect(c.constructor.name).toEqual(d.constructor.name); + expect({ test: c }).not.toStrictEqual({ test: d }); + }); + + it("passes for matching sparse arrays", () => { + expect([, 1]).toStrictEqual([, 1]); + }); + + it("does not pass when sparseness of arrays do not match", () => { + expect([, 1]).not.toStrictEqual([undefined, 1]); + expect([undefined, 1]).not.toStrictEqual([, 1]); + expect([, , , 1]).not.toStrictEqual([, 1]); + }); + + it("does not pass when equally sparse arrays have different values", () => { + expect([, 1]).not.toStrictEqual([, 2]); + }); + + it("does not pass when ArrayBuffers are not equal", () => { expect(Uint8Array.from([1, 2]).buffer).not.toStrictEqual( - Uint8Array.from([0, 0]).buffer, - ) + Uint8Array.from([0, 0]).buffer + ); expect(Uint8Array.from([2, 1]).buffer).not.toStrictEqual( - Uint8Array.from([2, 2]).buffer, - ) + Uint8Array.from([2, 2]).buffer + ); expect(Uint8Array.from([]).buffer).not.toStrictEqual( - Uint8Array.from([1]).buffer, - ) - }) + Uint8Array.from([1]).buffer + ); + }); - it('passes for matching buffers', () => { + it("passes for matching buffers", () => { expect(Uint8Array.from([1]).buffer).toStrictEqual( - Uint8Array.from([1]).buffer, - ) + Uint8Array.from([1]).buffer + ); expect(Uint8Array.from([]).buffer).toStrictEqual( - Uint8Array.from([]).buffer, - ) + Uint8Array.from([]).buffer + ); expect(Uint8Array.from([9, 3]).buffer).toStrictEqual( - Uint8Array.from([9, 3]).buffer, - ) - }) + Uint8Array.from([9, 3]).buffer + ); + }); - it('does not pass for DataView', () => { + it("does not pass for DataView", () => { expect(new DataView(Uint8Array.from([1, 2, 3]).buffer)).not.toStrictEqual( - new DataView(Uint8Array.from([3, 2, 1]).buffer), - ) + new DataView(Uint8Array.from([3, 2, 1]).buffer) + ); expect(new DataView(Uint16Array.from([1, 2]).buffer)).not.toStrictEqual( - new DataView(Uint16Array.from([2, 1]).buffer), - ) - }) + new DataView(Uint16Array.from([2, 1]).buffer) + ); + }); - it('passes for matching DataView', () => { + it("passes for matching DataView", () => { expect(new DataView(Uint8Array.from([1, 2, 3]).buffer)).toStrictEqual( - new DataView(Uint8Array.from([1, 2, 3]).buffer), - ) + new DataView(Uint8Array.from([1, 2, 3]).buffer) + ); expect(new DataView(Uint8Array.from([]).buffer)).toStrictEqual( - new DataView(Uint8Array.from([]).buffer), - ) - }) -}) + new DataView(Uint8Array.from([]).buffer) + ); + }); +}); -describe('toBeTypeOf()', () => { - it('pass with typeof', () => { +describe("toBeTypeOf()", () => { + it("pass with typeof", () => { [ - [1n, 'bigint'], - [true, 'boolean'], - [false, 'boolean'], - [(() => {}) as () => void, 'function'], - [function () {} as () => void, 'function'], - [1, 'number'], - [Number.POSITIVE_INFINITY, 'number'], - [Number.NaN, 'number'], - [0, 'number'], - [{}, 'object'], - [[], 'object'], - [null, 'object'], - ['', 'string'], - ['test', 'string'], - [Symbol('test'), 'symbol'], - [undefined, 'undefined'], - ].forEach(value => { + [1n, "bigint"], + [true, "boolean"], + [false, "boolean"], + [(() => {}) as () => void, "function"], + [function () {} as () => void, "function"], + [1, "number"], + [Number.POSITIVE_INFINITY, "number"], + [Number.NaN, "number"], + [0, "number"], + [{}, "object"], + [[], "object"], + [null, "object"], + ["", "string"], + ["test", "string"], + [Symbol("test"), "symbol"], + [undefined, "undefined"], + ].forEach((value) => { // @ts-ignore expect(value[0]).toBeTypeOf(value[1]); - }) - }) - it('pass with negotiation', () => { + }); + }); + it("pass with negotiation", () => { // @ts-ignore - expect('test').not.toBeTypeOf('number') - }) -}) + expect("test").not.toBeTypeOf("number"); + }); +}); -describe('toSatisfy()', () => { - const isOdd = (value: number) => value % 2 !== 0 +describe("toSatisfy()", () => { + const isOdd = (value: number) => value % 2 !== 0; - it('pass with 0', () => { + it("pass with 0", () => { // @ts-ignore - expect(1).toSatisfy(isOdd) - }) + expect(1).toSatisfy(isOdd); + }); - it('pass with negotiation', () => { + it("pass with negotiation", () => { // @ts-ignore - expect(2).not.toSatisfy(isOdd) - }) -}) - - + expect(2).not.toSatisfy(isOdd); + }); +}); -it('timeout', () => new Promise(resolve => setTimeout(resolve, 500))) +it("timeout", () => new Promise((resolve) => setTimeout(resolve, 0))); diff --git a/vitest.config.mjs b/vitest.config.mjs index 1eb87a6d0b..27662a5368 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -1,9 +1,9 @@ -import { defineConfig } from 'vitest/config' +import { defineConfig } from "vitest/config"; export default defineConfig({ - test: { - /* for example, use global to avoid globals imports (describe, test, expect): */ - globals: true, - // mockReset: true - }, -}) + test: { + /* for example, use global to avoid globals imports (describe, test, expect): */ + globals: true, + // mockReset: true + }, +});